This is an automated email from the ASF dual-hosted git repository.
aradzinski pushed a commit to branch NLPCRAFT-520
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
The following commit(s) were added to refs/heads/NLPCRAFT-520 by this push:
new 0e8caf34 Scaladoc.
0e8caf34 is described below
commit 0e8caf340d666eb1f3e65acd3255cdfd4805d359
Author: Aaron Radzinski <[email protected]>
AuthorDate: Tue Dec 27 11:22:55 2022 -0800
Scaladoc.
---
.../nlp/parsers/NCOpenNLPEntityParser.scala | 24 +++++++++++++---------
.../nlp/parsers/NCOpenNLPTokenParser.scala | 11 +++++-----
2 files changed, 20 insertions(+), 15 deletions(-)
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/parsers/NCOpenNLPEntityParser.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/parsers/NCOpenNLPEntityParser.scala
index eb1c1c4f..854c941e 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/parsers/NCOpenNLPEntityParser.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/parsers/NCOpenNLPEntityParser.scala
@@ -33,27 +33,31 @@ import scala.language.postfixOps
import scala.util.Using
/**
- * [[https://opennlp.apache.org/ OpenNLP]] based language independent
[[NCEntityParser entity parser]] configured by
+ * [[https://opennlp.apache.org/ OpenNLP]] based language independent
[[NCEntityParser entity parser]] configured using
* [[https://opennlp.apache.org/ OpenNLP]] **name finders** models.
*
- * This parser prepares [[NCEntity]] instances which are detected by given
models.
- * These entities are created with type `opennlp:modelName`, where
`modelName` is [[https://opennlp.apache.org/ OpenNLP]] model name.
- * Also this parser adds `opennlp:modelName:probability` double
[[NCPropertyMap metadata]] property to the
- * created entities extracted from related [[https://opennlp.apache.org/
OpenNLP]] model.
+ * This parser prepares [[NCEntity]] instances which are detected by the
provided models.
+ * These entities are created with type `opennlp:modelName`, where
`modelName` is the model name.
+ * This parser also adds `opennlp:modelName:probability` double
[[NCPropertyMap metadata]] property to the
+ * entities extracted from the corresponding model.
*
- * Some of OpenNLP prepared models can be found
[[https://opennlp.sourceforge.net/models-1.5/ here]].
+ * Some of free OpenNLP community-maintained models can be found
[[https://opennlp.sourceforge.net/models-1.5/ here]].
*
- * **NOTE:** that parser can produce different types of [[NCEntity]]
instances and each input [[NCToken]] can be included into several output
[[NCEntity]] instances.
+ * **NOTE:** that parser can be configured with multiple models and therefore
may produce different types of
+ * [[NCEntity]] instances with each input [[NCToken]] being "mapped" into
zero, one or more different entities.
+ * As a result, each input token may be included into more than one output
[[NCEntity]] instances (or none at all).
*
- * @param findersMdlsRes Relative paths, absolute paths, resources or URLs to
[[https://opennlp.apache.org/docs/2.0.0/apidocs/opennlp-tools/opennlp/tools/namefind/TokenNameFinderModel.html
models]].
+ * @param findersMdlsRes Relative paths, absolute paths, resources or URLs to
OpenNLP name finders
+ *
[[https://opennlp.apache.org/docs/2.0.0/apidocs/opennlp-tools/opennlp/tools/namefind/TokenNameFinderModel.html
models]].
*/
class NCOpenNLPEntityParser(findersMdlsRes: List[String]) extends
NCEntityParser with LazyLogging:
require(findersMdlsRes != null && findersMdlsRes.nonEmpty, "Models
resources cannot be null or empty.")
/**
- * Creates [[NCOpenNLPEntityParser]] instance.
+ * Creates new parser with just one model.
*
- * @param mdl Relative path, absolute path, classpath resource or URL to
[[https://opennlp.apache.org/docs/2.0.0/apidocs/opennlp-tools/opennlp/tools/namefind/TokenNameFinderModel.html
model]].
+ * @param mdl Relative path, absolute path, classpath resource or URL to
OpenNLP name finders
+ *
[[https://opennlp.apache.org/docs/2.0.0/apidocs/opennlp-tools/opennlp/tools/namefind/TokenNameFinderModel.html
model]].
*/
def this(mdl: String) = this(List[String](Objects.requireNonNull(mdl)))
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/parsers/NCOpenNLPTokenParser.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/parsers/NCOpenNLPTokenParser.scala
index 2c1dc7ef..40243e76 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/parsers/NCOpenNLPTokenParser.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/nlp/parsers/NCOpenNLPTokenParser.scala
@@ -27,12 +27,13 @@ import java.util
import java.util.Objects
/**
- * [[https://opennlp.apache.org/ OpenNLP]] based language independent
[[NCTokenParser entity parser]] configured
- * by path to [[https://opennlp.apache.org/ OpenNLP]] **tokenizers** model.
+ * [[https://opennlp.apache.org/ OpenNLP]] based language independent
[[NCTokenParser entity parser]] configured
+ * using path to [[https://opennlp.apache.org/ OpenNLP]] **tokenizer** model.
*
- * Some of OpenNLP prepared models can be found
[[https://opennlp.sourceforge.net/models-1.5/ here]].
+ * Some of free OpenNLP community-maintained models can be found
[[https://opennlp.sourceforge.net/models-1.5/ here]].
*
- * @param tokMdlRes Relative path, absolute path, classpath resource or URL
to
[[https://opennlp.apache.org/docs/2.0.0/apidocs/opennlp-tools/opennlp/tools/tokenize/TokenizerModel.html
model]].
+ * @param tokMdlRes Relative path, absolute path, classpath resource or URL
to the tokenizer
+ *
[[https://opennlp.apache.org/docs/2.0.0/apidocs/opennlp-tools/opennlp/tools/tokenize/TokenizerModel.html
model]].
*/
class NCOpenNLPTokenParser(tokMdlRes: String) extends NCTokenParser with
LazyLogging:
require(tokMdlRes != null, "Tokenizer model resource cannot be null.")
@@ -44,7 +45,7 @@ class NCOpenNLPTokenParser(tokMdlRes: String) extends
NCTokenParser with LazyLog
private def init(): Unit =
tokenizer = new TokenizerME(new
TokenizerModel(NCUtils.getStream(tokMdlRes)))
- logger.trace(s"Loaded resource: $tokMdlRes")
+ logger.trace(s"Loaded OpenNLP tokenizer model: $tokMdlRes")
/** @inheritdoc */
override def tokenize(text: String): List[NCToken] =