This is an automated email from the ASF dual-hosted git repository.
aradzinski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
The following commit(s) were added to refs/heads/master by this push:
new e4367131 Scaladoc.
e4367131 is described below
commit e4367131d319cd04ef93563bde3d8836bf4b5657
Author: Aaron Radzinski <[email protected]>
AuthorDate: Sun Sep 11 11:30:28 2022 -0700
Scaladoc.
---
.../scala/org/apache/nlpcraft/NCIntentSkip.scala | 16 +++++------
.../scala/org/apache/nlpcraft/NCTokenParser.scala | 31 +++++++++++-----------
.../org/apache/nlpcraft/NCTokenValidator.scala | 31 +++++++++++++---------
.../main/scala/org/apache/nlpcraft/NCVariant.scala | 9 ++++---
.../org/apache/nlpcraft/NCVariantFilter.scala | 23 +++++++++++++---
5 files changed, 66 insertions(+), 44 deletions(-)
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCIntentSkip.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCIntentSkip.scala
index 89176341..b4a9a749 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCIntentSkip.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCIntentSkip.scala
@@ -18,19 +18,15 @@
package org.apache.nlpcraft
/**
- * Control flow exception to skip current intent. This exception can be
thrown by the intent
- * callback to indicate that current intent should be skipped (even though
- * it was matched and its callback was called). If there's more than one
intent matched the next best matching intent
- * will be selected and its callback will be called.
- * <p>
+ * Control flow exception to skip current intent. This exception can be
thrown by the intent callback to indicate
+ * that current intent should be skipped (even though it was matched and its
callback was called). If there's more
+ * than one intent matched the next best matching intent will be selected and
its callback will be called.
+ *
* This exception becomes useful when it is hard or impossible to encode the
entire matching logic using just
* declarative IDL. In these cases the intent definition can be relaxed and
the "last mile" of intent
* matching can happen inside the intent callback's user logic. If it is
determined that intent in fact does
* not match then throwing this exception allows to try next best matching
intent, if any.
*
- * @see [[NCIntent
- * @see [[NCIntentTerm
- * @see [[NCIntentRef
- * @see [[NCIntentMatch
- * @see [[NCModel#onMatchedIntent(NCIntentMatch) */
+ * @see [[NCModel.onMatchedIntent()]]
+ */
class NCIntentSkip(msg: String, cause: Throwable = null) extends
NCException(msg, cause)
\ No newline at end of file
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCTokenParser.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCTokenParser.scala
index 973fdfbd..4157181f 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCTokenParser.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCTokenParser.scala
@@ -18,24 +18,25 @@
package org.apache.nlpcraft
/**
- * A tokenizer that splits a text into the list of {@link NCToken tokens}.
- * <p>
- * See {@link NCPipeline} for documentation on the token parser place
- * in the overall processing pipeline.
+ * A tokenizer that splits given text into the list of [[NCToken]] objects.
This is one of the user-defined
+ * components of the processing [[NCPipeline pipeline]]. See [[NCPipeline]]
for documentation on the token
+ * parser place in the overall processing pipeline.
*
- * @see [[NCEntity
- * @see [[NCToken
- * @see [[NCTokenParser
- * @see [[NCTokenEnricher
- * @see [[NCTokenValidator
- * @see [[NCEntityParser
- * @see [[NCEntityEnricher
- * @see [[NCEntityValidator
- * @see [[NCEntityMapper */
+ * @see [[NCEntity]]
+ * @see [[NCToken]]
+ * @see [[NCTokenParser]]
+ * @see [[NCTokenEnricher]]
+ * @see [[NCTokenValidator]]
+ * @see [[NCEntityParser]]
+ * @see [[NCEntityEnricher]]
+ * @see [[NCEntityValidator]]
+ * @see [[NCEntityMapper]]
+ */
trait NCTokenParser:
/**
+ * Splits given text into list of [[NCToken]] objects.
*
- * @param text
- * @return
+ * @param text Input text to split.
+ * @return List of split token. Can be empty but should never be `null`.
*/
def tokenize(text: String): List[NCToken]
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCTokenValidator.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCTokenValidator.scala
index f6ec9331..546f9b73 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCTokenValidator.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCTokenValidator.scala
@@ -18,22 +18,29 @@
package org.apache.nlpcraft
/**
+ * A pipeline component that allows to validate a list of tokens produced by
token parser before they get
+ * sent further down the pipeline. This is one of the user-defined
+ * components of the processing [[NCPipeline pipeline]]. See [[NCPipeline]]
for documentation on the token
+ * parser place in the overall processing pipeline.
*
- * @see [[NCEntity
- * @see [[NCToken
- * @see [[NCTokenParser
- * @see [[NCTokenEnricher
- * @see [[NCTokenValidator
- * @see [[NCEntityParser
- * @see [[NCEntityEnricher
- * @see [[NCEntityValidator
- * @see [[NCEntityMapper */
+ * @see [[NCEntity]]
+ * @see [[NCToken]]
+ * @see [[NCTokenParser]]
+ * @see [[NCTokenEnricher]]
+ * @see [[NCTokenValidator]]
+ * @see [[NCEntityParser]]
+ * @see [[NCEntityEnricher]]
+ * @see [[NCEntityValidator]]
+ * @see [[NCEntityMapper]]
+ */
trait NCTokenValidator extends NCLifecycle:
/**
+ * Validates given list of tokens. If validation fails this method should
throw an [[NCException]]. Note that
+ * token validator is called for an empty list of tokens as well.
*
- * @param req
- * @param cfg
- * @param toks
+ * @param req Input request,
+ * @param cfg Model configuration.
+ * @param toks List of tokens to validate. Can be empty but never `null`.
*/
def validate(req: NCRequest, cfg: NCModelConfig, toks: List[NCToken]): Unit
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCVariant.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCVariant.scala
index e46b0ef5..a77c3770 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCVariant.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCVariant.scala
@@ -18,9 +18,12 @@
package org.apache.nlpcraft
/**
- * A parsing variant is a list of entities defining one possible parsing of
the input query. Note that a given input
- * can have one or more possible different parsing variants. Depending on
model configuration a user input
- * can produce hundreds or even thousands of parsing variants.
+ * A parsing variant is a list of entities defining one possible parsing of
the input query. Note that a given user
+ * input almost always has one or more possible different parsing variants.
Furthermore, depending on the model
+ * configuration a user input can produce hundreds and even thousands of
parsing variants.
+ *
+ * Pipeline provides user-defined variant filter component
[[NCVariantFilter]] to allow a programmatic filtration of
+ * the variants. Note that even a few dozens of variants can significantly
slow down the overall NLPCraft processing.
*
* @see [[NCModel.onVariant()]]
*/
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCVariantFilter.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCVariantFilter.scala
index 1de2c157..2cbe5f96 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCVariantFilter.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCVariantFilter.scala
@@ -18,14 +18,29 @@
package org.apache.nlpcraft
/**
+ * A pipeline component that allows to filter out unnecessary [[NCVariant
parsing variants]]. Note that a given user
+ * input almost always has one or more possible different parsing variants.
Furthermore, depending on the model
+ * configuration a user input can produce hundreds and even thousands of
parsing variants. This is one of the user-defined
+ * components of the processing [[NCPipeline pipeline]]. See [[NCPipeline]]
for documentation on the token
+ * parser place in the overall processing pipeline.
*
+ * @see [[NCEntity]]
+ * @see [[NCToken]]
+ * @see [[NCTokenParser]]
+ * @see [[NCTokenEnricher]]
+ * @see [[NCTokenValidator]]
+ * @see [[NCEntityParser]]
+ * @see [[NCEntityEnricher]]
+ * @see [[NCEntityValidator]]
+ * @see [[NCEntityMapper]]
*/
trait NCVariantFilter extends NCLifecycle:
/**
+ * Filters out given parsing variants.
*
- * @param req
- * @param cfg
- * @param vars
- * @return
+ * @param req Input request,
+ * @param cfg Model configuration.
+ * @param vars List of parsing variants to filter out.
+ * @return List of filtered out parsing variants. Can be empty but should
never be `null`.
*/
def filter(req: NCRequest, cfg: NCModelConfig, vars: List[NCVariant]):
List[NCVariant]