This is an automated email from the ASF dual-hosted git repository.

aradzinski pushed a commit to branch NLPCRAFT-495
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git


The following commit(s) were added to refs/heads/NLPCRAFT-495 by this push:
     new 6bf063c4 Code review on NLPCRAFT-495 and NLPCRAFTY-505.
6bf063c4 is described below

commit 6bf063c421221f9c3683b43203a6ca14754e2fc1
Author: Aaron Radzinski <[email protected]>
AuthorDate: Wed Jul 6 10:57:36 2022 -0700

    Code review on NLPCRAFT-495 and NLPCRAFTY-505.
---
 .../examples/lightswitch/LightSwitchFrModel.scala  |  2 -
 .../lightswitch/LightSwitchScalaModel.scala        |  3 +-
 .../apache/nlpcraft/examples/time/TimeModel.scala  |  2 +-
 .../main/scala/org/apache/nlpcraft/NCContext.scala | 21 ++++---
 .../scala/org/apache/nlpcraft/NCConversation.scala |  4 +-
 .../main/scala/org/apache/nlpcraft/NCEntity.scala  |  4 +-
 .../scala/org/apache/nlpcraft/NCEntityParser.scala |  2 +-
 .../scala/org/apache/nlpcraft/NCIntentMatch.scala  |  8 +--
 .../main/scala/org/apache/nlpcraft/NCModel.scala   | 64 ++++++++++++----------
 .../scala/org/apache/nlpcraft/NCModelConfig.scala  |  6 +-
 .../scala/org/apache/nlpcraft/NCPipeline.scala     |  2 +-
 .../scala/org/apache/nlpcraft/NCPropertyMap.scala  | 22 ++++----
 .../main/scala/org/apache/nlpcraft/NCRequest.scala |  2 +-
 .../main/scala/org/apache/nlpcraft/NCToken.scala   |  4 +-
 .../main/scala/org/apache/nlpcraft/NCVariant.scala |  2 +-
 .../internal/dialogflow/NCDialogFlowManager.scala  |  2 +-
 .../nlpcraft/internal/impl/NCModelScanner.scala    |  5 +-
 .../intent/matcher/NCIntentSolverManager.scala     |  2 +-
 18 files changed, 83 insertions(+), 74 deletions(-)

diff --git 
a/nlpcraft-examples/lightswitch-fr/src/main/scala/org/apache/nlpcraft/examples/lightswitch/LightSwitchFrModel.scala
 
b/nlpcraft-examples/lightswitch-fr/src/main/scala/org/apache/nlpcraft/examples/lightswitch/LightSwitchFrModel.scala
index eb0d8533..d3ab533e 100644
--- 
a/nlpcraft-examples/lightswitch-fr/src/main/scala/org/apache/nlpcraft/examples/lightswitch/LightSwitchFrModel.scala
+++ 
b/nlpcraft-examples/lightswitch-fr/src/main/scala/org/apache/nlpcraft/examples/lightswitch/LightSwitchFrModel.scala
@@ -92,9 +92,7 @@ class LightSwitchFrModel extends NCModelAdapter(
         val locations = if locEnts.isEmpty then "toute la maison" else 
locEnts.map(_.mkText).mkString(", ")
 
         // Add HomeKit, Arduino or other integration here.
-
         // By default - just return a descriptive action string.
-
         NCResult(
             new Gson().toJson(Map("locations" -> locations, "action" -> 
action).asJava),
             NCResultType.ASK_RESULT
diff --git 
a/nlpcraft-examples/lightswitch/src/main/scala/org/apache/nlpcraft/examples/lightswitch/LightSwitchScalaModel.scala
 
b/nlpcraft-examples/lightswitch/src/main/scala/org/apache/nlpcraft/examples/lightswitch/LightSwitchScalaModel.scala
index 119542cb..39727959 100644
--- 
a/nlpcraft-examples/lightswitch/src/main/scala/org/apache/nlpcraft/examples/lightswitch/LightSwitchScalaModel.scala
+++ 
b/nlpcraft-examples/lightswitch/src/main/scala/org/apache/nlpcraft/examples/lightswitch/LightSwitchScalaModel.scala
@@ -84,8 +84,7 @@ class LightSwitchScalaModel extends NCModelAdapter(
         val status = if actEnt.getId == "ls:on" then "on" else "off"
         val locations = if locEnts.isEmpty then "entire house" else 
locEnts.map(_.mkText).mkString(", ")
 
-        // Add HomeKit, Arduino or other integration here.
-
+        // Add HomeKit, Arduino or other integration here.=
         // By default - just return a descriptive action string.
         NCResult(
             s"Lights are [$status] in [${locations.toLowerCase}].",
diff --git 
a/nlpcraft-examples/time/src/main/scala/org/apache/nlpcraft/examples/time/TimeModel.scala
 
b/nlpcraft-examples/time/src/main/scala/org/apache/nlpcraft/examples/time/TimeModel.scala
index 4eea5984..2a7e0bf3 100644
--- 
a/nlpcraft-examples/time/src/main/scala/org/apache/nlpcraft/examples/time/TimeModel.scala
+++ 
b/nlpcraft-examples/time/src/main/scala/org/apache/nlpcraft/examples/time/TimeModel.scala
@@ -75,7 +75,7 @@ class TimeModel extends NCModelAdapter(
       * @param s
       * @return */
     private def capitalize(s: String): String =
-        if s == null || s.isEmpty then s else s.substring(0, 1).toUpperCase + 
s.substring(1, s.length)
+        if s == null || s.isEmpty then s else s"${s.substring(0, 
1).toUpperCase}${s.substring(1, s.length)}"
 
     /**
       * Callback on remote time intent match.
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCContext.scala 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCContext.scala
index e2d3e5fb..d5558458 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCContext.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCContext.scala
@@ -20,41 +20,48 @@ package org.apache.nlpcraft
 /**
   * A context containing a fully parsed data from the input query.
   *
-  * @see NCModel#onContext(NCContext) */
+  * @see NCModel#onContext(NCContext)
+  */
 trait NCContext:
     /**
       * Tests if given entity is part of the query this context is associated 
with.
       *
-      * @param ent Entity to check. */
+      * @param ent Entity to check.
+      */
     def isOwnerOf(ent: NCEntity): Boolean
 
     /**
       * Gets configuration of the model this context is associated with.
       *
-      * @return Model. */
+      * @return Model.
+      */
     def getModelConfig: NCModelConfig
 
     /**
       * Gets user request container.
       *
-      * @return User request. */
+      * @return User request.
+      */
     def getRequest: NCRequest
 
     /**
       * Gets current conversation for this context.
       *
-      * @return Current conversation. */
+      * @return Current conversation.
+      */
     def getConversation: NCConversation
 
     /**
       * Gets the list of parsing variants. Returned list always contains as 
least one parsing variant.
       *
       * @return A non-empty list of parsing variants.
-      * @see NCModel#onVariant(NCVariant) */
+      * @see NCModel#onVariant(NCVariant)
+      */
     def getVariants: List[NCVariant]
 
     /**
       * Gets the list of all tokens for the input query this context is 
associated with.
       *
-      * @return List of tokens for this context. Can be empty but never {@code 
null}. */
+      * @return List of tokens for this context. Can be empty but never `null`.
+      */
     def getTokens: List[NCToken]
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCConversation.scala 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCConversation.scala
index 37cc0059..b2961cd8 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCConversation.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCConversation.scala
@@ -54,7 +54,7 @@ trait NCConversation:
       * policy as the conversation it belongs to. Specifically, this returned 
container will be cleared when the
       * conversation gets cleared automatically (by timeout or depth) or 
manually.
       *
-      * @return User-defined conversation data container. Can be empty but 
never {@code null}. */
+      * @return User-defined conversation data container. Can be empty but 
never `null`. */
     def getData: NCPropertyMap
 
     /**
@@ -66,7 +66,7 @@ trait NCConversation:
       * should not rely on any observed behavior of how STM stores and evicts 
its content).
       *
       * @return List of entities for this conversation's STM. The list can be 
empty which indicates that conversation
-      * is brand new or expired - but never {@code null}. */
+      * is brand new or expired - but never `null`. */
     def getStm: List[NCEntity]
 
     /**
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCEntity.scala 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCEntity.scala
index 02bb4634..32072a43 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCEntity.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCEntity.scala
@@ -41,7 +41,7 @@ package org.apache.nlpcraft
 trait NCEntity extends NCPropertyMap:
 
     /**
-      * Gets the list of tokens this entity is comprised of. Returned list is 
never empty or {@code null}.
+      * Gets the list of tokens this entity is comprised of. Returned list is 
never empty or `null`.
       *
       * @return List of tokens that are part of this entity. */
     def getTokens: List[NCToken]
@@ -64,7 +64,7 @@ trait NCEntity extends NCPropertyMap:
     /**
       * Gets optional set of groups this entity belongs to.
       *
-      * @return Optional set of groups this entity belongs to. Returned set 
can be empty but never {@code null}. */
+      * @return Optional set of groups this entity belongs to. Returned set 
can be empty but never `null`. */
     def getGroups: Set[String] = Set(getId)
 
     /**
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCEntityParser.scala 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCEntityParser.scala
index d2687de5..343aa562 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCEntityParser.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCEntityParser.scala
@@ -39,7 +39,7 @@ trait NCEntityParser extends NCLifecycle:
       * @param req Input request descriptor.
       * @param cfg Configuration of the model this component is associated 
with.
       * @param toks List of tokens to convert.
-      * @return List of parsed entities, potentially empty but never {@code 
null}.
+      * @return List of parsed entities, potentially empty but never `null`.
       * @@throws NCException Thrown in case of any errors. */
     def parse(req: NCRequest, cfg: NCModelConfig, toks: List[NCToken]): 
List[NCEntity]
 
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCIntentMatch.scala 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCIntentMatch.scala
index fe0f5893..24fc9ede 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCIntentMatch.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCIntentMatch.scala
@@ -29,7 +29,7 @@ trait NCIntentMatch:
 
     /**
       * Gets a subset of entities representing matched intent. This subset is 
grouped by the matched terms
-      * where a {@code null} sub-list defines an optional term. Order and 
index of sub-lists corresponds
+      * where a `null` sub-list defines an optional term. Order and index of 
sub-lists corresponds
       * to the order and index of terms in the matching intent. Number of 
sub-lists will always be the same
       * as the number of terms in the matched intent.
       * <p>
@@ -46,7 +46,7 @@ trait NCIntentMatch:
       * Consider using {@link NCIntentTerm} annotation instead for simpler 
access to the intent entities.
       *
       * @param idx Index of the term (starting from <code>0</code>).
-      * @return List of entities, potentially {@code null}, for given term.
+      * @return List of entities, potentially `null`, for given term.
       * @see NCIntentTerm
       * @see #getTermEntities(String) */
     def getTermEntities(idx: Int): List[NCEntity]
@@ -57,10 +57,10 @@ trait NCIntentMatch:
       * Consider using {@link NCIntentTerm} annotation instead for simpler 
access to the intent entities.
       *
       * @param termId ID of the term for which to get entities.
-      * @return List of entities, potentially {@code null}, for given term.
+      * @return List of entities, potentially `null`, for given term.
       * @see NCIntentTerm
       * @see #getTermEntities(int) */
-    def getTermEntities(termId: String):  List[NCEntity]
+    def getTermEntities(termId: String): List[NCEntity]
 
     /**
       * Gets parsing variant that produced the matching for this intent. 
Returned variant is one of the
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCModel.scala 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCModel.scala
index a0244fe5..6a121a29 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCModel.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCModel.scala
@@ -67,13 +67,15 @@ trait NCModel:
     /**
       * Gets model configuration.
       *
-      * @return Model configuration. */
+      * @return Model configuration.
+      */
     def getConfig: NCModelConfig
 
     /**
       * Gets model NLP processing pipeline.
       *
-      * @return NLP processing pipeline. */
+      * @return NLP processing pipeline.
+      */
     def getPipeline: NCPipeline
 
     /**
@@ -85,10 +87,11 @@ trait NCModel:
       * slow down the overall processing. This method allows to filter out 
unnecessary parsing variants based on
       * variety of user-defined factors like number of entities, presence of a 
particular entity in the variant, etc.
       * <p>
-      * By default, this method accepts all variants (returns {@code true}).
+      * By default, this method accepts all variants (returns `true`).
       *
       * @param vrn A parsing variant to accept or reject.
-      * @return {@code True} to accept variant for further processing, {@code 
false} otherwise. */
+      * @return {@code True} to accept variant for further processing, `false` 
otherwise.
+      */
     def onVariant(vrn: NCVariant) = true
 
     /**
@@ -98,21 +101,22 @@ trait NCModel:
       * Typical use case for this callback is to perform logging, debugging, 
statistic or usage collection, explicit
       * update or initialization of conversation context, security audit or 
validation, etc.
       * <p>
-      * Default implementation returns {@code null}.
+      * Default implementation returns `null`.
       *
       * @param ctx Input query context.
       * @return Optional query result to return interrupting the default 
workflow. Specifically, if this method
-      * returns a non-{@code null} result, it will be returned to the caller 
immediately overriding default behavior.
-      * If the method returns {@code null} - the default processing flow will 
continue.
-      * @throws NCRejection This callback can throw the rejection exception to 
abort input query processing. */
+      * returns a non-`null` result, it will be returned to the caller 
immediately overriding default behavior.
+      * If the method returns `null` - the default processing flow will 
continue.
+      * @throws NCRejection This callback can throw the rejection exception to 
abort input query processing.
+      */
     @throws[NCRejection] def onContext(ctx: NCContext): Option[NCResult] = None
 
     /**
       * A callback that is called when intent was successfully matched but 
right before its callback is called. This
       * callback is called after {@link # onContext ( NCContext )} is called 
and may be called multiple times
-      * depending on its return value. If {@code true} is returned than the 
default workflow will continue and the
-      * matched intent's callback will be called. However, if {@code null} is 
returned than the entire existing set of
-      * parsing variants will be matched against all declared intents again. 
Returning {@code false} allows this
+      * depending on its return value. If `true` is returned than the default 
workflow will continue and the
+      * matched intent's callback will be called. However, if `null` is 
returned than the entire existing set of
+      * parsing variants will be matched against all declared intents again. 
Returning `false` allows this
       * method to alter the state of the model (like soft-reset conversation 
or change metadata) and force the
       * full re-evaluation of the parsing variants against all declared 
intents.
       * <p>
@@ -121,17 +125,18 @@ trait NCModel:
       * Typical use case for this callback is to perform logging, debugging, 
statistic or usage collection, explicit
       * update or initialization of conversation context, security audit or 
validation, etc.
       * <p>
-      * By default, this method returns {@code true}.
+      * By default, this method returns `true`.
       *
       * @param im Intent match context - the same instance that's passed to 
the matched intent callback.
-      * @return If {@code true} is returned than the default workflow will 
continue and the matched intent's
-      * callback will be called. However, if {@code false} is returned than 
the entire existing set of
+      * @return If `true` is returned than the default workflow will continue 
and the matched intent's
+      * callback will be called. However, if `false` is returned than the 
entire existing set of
       * parsing variants will be matched against all declared intents again. 
Returning false allows this
       * method to alter the state of the model (like soft-reset conversation 
or change metadata) and force
       * the re-evaluation of the parsing variants against all declared 
intents. Note that user logic should be
       * careful not to induce infinite loop in this behavior.
       * @throws NCRejection This callback can throw the rejection exception to 
abort user request processing. In this
-      * case the {@link # onRejection ( NCIntentMatch, NCRejection)} callback 
will be called next. */
+      * case the {@link # onRejection ( NCIntentMatch, NCRejection)} callback 
will be called next.
+      */
     @throws[NCRejection] def onMatchedIntent(ctx: NCContext, im: 
NCIntentMatch) = true
 
     /**
@@ -141,15 +146,16 @@ trait NCModel:
       * for this callback is to perform logging, debugging, statistic or usage 
collection, explicit update or
       * initialization of conversation context, security audit or validation, 
etc.
       * <p>
-      * Default implementation is a no-op returning {@code null}.
+      * Default implementation is a no-op returning `null`.
       *
       * @param im Intent match context - the same instance that's passed to 
the matched intent callback
       * that produced this result.
       * @param res Existing result.
       * @return Optional query result to return interrupting the default 
workflow. Specifically, if this
-      * method returns a non-{@code null} result, it will be returned to the 
caller immediately overriding
-      * default behavior and existing query result or error processing, if 
any. If the method returns {@code null} -
-      * the default processing flow will continue. */
+      * method returns a non-`null` result, it will be returned to the caller 
immediately overriding
+      * default behavior and existing query result or error processing, if 
any. If the method returns `null` -
+      * the default processing flow will continue.
+      */
     def onResult(ctx: NCContext, im: NCIntentMatch, res: NCResult): 
Option[NCResult] = None
 
     /**
@@ -159,15 +165,16 @@ trait NCModel:
       * statistic or usage collection, explicit update or initialization of 
conversation context, security audit or
       * validation, etc.
       * <p>
-      * Default implementation is a no-op returning {@code null}.
+      * Default implementation is a no-op returning `null`.
       *
       * @param ctx Optional intent match context - the same instance that's 
passed to the matched intent callback
-      * that produced this rejection. It is {@code null} if rejection was 
triggered outside the intent callback.
+      * that produced this rejection. It is `null` if rejection was triggered 
outside the intent callback.
       * @param e Rejection exception.
       * @return Optional query result to return interrupting the default 
workflow. Specifically, if this method
-      * returns a non-{@code null} result, it will be returned to the caller 
immediately overriding default behavior
-      * and existing query result or error processing, if any. If the method 
returns {@code null} - the default
-      * processing flow will continue. */
+      * returns a non-`null` result, it will be returned to the caller 
immediately overriding default behavior
+      * and existing query result or error processing, if any. If the method 
returns `null` - the default
+      * processing flow will continue.
+      */
     def onRejection(ctx: NCContext, im: Option[NCIntentMatch], e: 
NCRejection): Option[NCResult] = None
 
     /**
@@ -176,12 +183,13 @@ trait NCModel:
       * to perform logging, debugging, statistic or usage collection, explicit 
update or initialization of conversation
       * context, security audit or validation, etc.
       * <p>
-      * Default implementation is a no-op returning {@code null}.
+      * Default implementation is a no-op returning `null`.
       *
       * @param ctx Intent match context - the same instance that's passed to 
the matched intent that produced this error.
       * @param e Failure exception.
       * @return Optional query result to return interrupting the default 
workflow. Specifically, if this method
-      * returns a non-{@code null} result, it will be returned to the caller 
immediately overriding default
-      * behavior and existing query result or error processing, if any. If the 
method returns {@code null} - the
-      * default processing flow will continue. */
+      * returns a non-`null` result, it will be returned to the caller 
immediately overriding default
+      * behavior and existing query result or error processing, if any. If the 
method returns `null` - the
+      * default processing flow will continue.
+      */
     def onError(ctx: NCContext, e: Throwable): Option[NCResult] = None
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCModelConfig.scala 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCModelConfig.scala
index a39aae62..08793d8e 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCModelConfig.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCModelConfig.scala
@@ -27,9 +27,9 @@ object NCModelConfig:
     val DFLT_CONV_TIMEOUT: Long = Duration.ofMinutes(60).toMillis
     val DFLT_CONV_DEPTH = 3
 
-    def apply(id: String, name: String, version: String) = new 
NCModelConfig(id, name, version)
-    def apply(id: String, name: String, version: String, description: String, 
origin: String) =
-        new NCModelConfig(id, name, version, Some(description), Some(origin))
+    def apply(id: String, name: String, ver: String) = new NCModelConfig(id, 
name, ver)
+    def apply(id: String, name: String, ver: String, desc: String, orig: 
String) =
+        new NCModelConfig(id, name, ver, Option(desc), Option(orig))
 import org.apache.nlpcraft.NCModelConfig.*
 
 /**
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCPipeline.scala 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCPipeline.scala
index 5b762ab6..ea310681 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCPipeline.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCPipeline.scala
@@ -96,6 +96,6 @@ trait NCPipeline:
     /**
       * Gets optional list of entity mappers.
       *
-      * @return Optional list of entity mappers. Can be empty but never {@code 
null}.
+      * @return Optional list of entity mappers. Can be empty but never `null`.
       */
     def getEntityMappers: List[NCEntityMapper] = List.empty
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCPropertyMap.scala 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCPropertyMap.scala
index ee1ab5f3..5565b7fa 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCPropertyMap.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCPropertyMap.scala
@@ -18,18 +18,18 @@
 package org.apache.nlpcraft
 
 /**
-  * Map-like container that provides support for mutable runtime-only 
propertes or metadata.
+  * Map-like container that provides support for mutable runtime-only 
properties or metadata.
   *
   * @see NCPropertyMapAdapter
   * @see NCToken
   * @see NCEntity */
 trait NCPropertyMap:
     /**
-      * Returns the value to which the specified key is mapped, or {@code 
null} if this map contains no mapping for the key.
+      * Returns the value to which the specified key is mapped, or `null` if 
this map contains no mapping for the key.
       *
       * @param key The key whose associated value is to be returned.
       * @param <T> Type of the returned value.
-      * @return The value to which the specified key is mapped, or {@code 
null} if this map contains no mapping for the key. */
+      * @return The value to which the specified key is mapped, or `null` if 
this map contains no mapping for the key. */
     def get[T](key: String): T
 
     /**
@@ -50,23 +50,23 @@ trait NCPropertyMap:
       * @param key Key with which the specified value is to be associated.
       * @param obj Value to be associated with the specified key.
       * @param <T> Type of the value.
-      * @return The previous value associated with key, or {@code null} if 
there was no mapping for key. */
+      * @return The previous value associated with key, or `null` if there was 
no mapping for key. */
     def put[T](key: String, obj: Any): T
 
     /**
-      * If the specified key is not already associated with a value (or is 
mapped to {@code null}) associates it with
-      * the given value and returns {@code null}, else returns the current 
value.
+      * If the specified key is not already associated with a value (or is 
mapped to `null`) associates it with
+      * the given value and returns `null`, else returns the current value.
       *
       * @param key Key with which the specified value is to be associate
       * @param obj Value to be associated with the specified key
       * @param <T> Type of the value.
-      * @return The previous value associated with the specified key, or 
{@code null} if there was no mapping for the key. */
+      * @return The previous value associated with the specified key, or 
`null` if there was no mapping for the key. */
     def putIfAbsent[T](key: String, obj: T): T
 
     /**
-      * Returns {@code true} if this map contains a mapping for the specified 
key.
+      * Returns `true` if this map contains a mapping for the specified key.
       *
-      * @return {@code true} if this map contains a mapping for the specified 
key. */
+      * @return `true` if this map contains a mapping for the specified key. */
     def contains(key: String): Boolean
 
     /**
@@ -74,7 +74,7 @@ trait NCPropertyMap:
       *
       * @param key Key whose mapping is to be removed from the map.
       * @param <T> Type of the value.
-      * @return The previous value associated with key, or {@code null} if 
there was no mapping for key. */
+      * @return The previous value associated with key, or `null` if there was 
no mapping for key. */
     def remove[T](key: String): T
 
     /**
@@ -82,7 +82,7 @@ trait NCPropertyMap:
       *
       * @param key Key with which the specified value is associated value.
       * @param obj Value expected to be associated with the specified key.
-      * @return {@code true} if the value was removed */
+      * @return `true` if the value was removed */
     def remove(key: String, obj: Any): Boolean
 
     /**
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCRequest.scala 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCRequest.scala
index 25136210..55272631 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCRequest.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCRequest.scala
@@ -55,5 +55,5 @@ trait NCRequest:
     /**
       * Gets optional user request data.
       *
-      * @return Optional user request data, can be empty but never {@code 
null}. */
+      * @return Optional user request data, can be empty but never `null`. */
     def getRequestData: Map[String, Any]
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCToken.scala 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCToken.scala
index 46ba149b..a9208693 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCToken.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCToken.scala
@@ -53,13 +53,13 @@ trait NCToken extends NCPropertyMap:
       * Gets the inclusive start position of this token's text in the original 
input text supplied to
       * {@link NCTokenParser# tokenize ( String )} method.
       *
-      * @return Start position (inlcusive) of this token's text in the 
original input text. */
+      * @return Start position (inclusive) of this token's text in the 
original input text. */
     def getStartCharIndex: Int
 
     /**
       * Gets the inclusive end position of this token's text in the original 
input text supplied to
       * {@link NCTokenParser# tokenize ( String )} method.
       *
-      * @return End position (invlusvie) of this token's text in the original 
input text.
+      * @return End position (inclusive) of this token's text in the original 
input text.
       * @return */
     def getEndCharIndex: Int
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCVariant.scala 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCVariant.scala
index 68b509f9..15485f16 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCVariant.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCVariant.scala
@@ -27,6 +27,6 @@ trait NCVariant:
     /**
       * Gets the list of entities for this variant.
       *
-      * @return List of entities for this variant. Can be empty but never 
{@code null}.
+      * @return List of entities for this variant. Can be empty but never 
`null`.
       */
     def getEntities: List[NCEntity]
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/dialogflow/NCDialogFlowManager.scala
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/dialogflow/NCDialogFlowManager.scala
index 4202ad41..9cc9bbb8 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/dialogflow/NCDialogFlowManager.scala
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/dialogflow/NCDialogFlowManager.scala
@@ -123,7 +123,7 @@ class NCDialogFlowManager(cfg: NCModelConfig) extends 
LazyLogging:
       * @param ctx
       */
     def replaceLastItem(intentMatch: NCIntentMatch, res: NCResult, ctx: 
NCContext): Unit =
-        val item = mkItem(intentMatch, Some(res), ctx)
+        val item = mkItem(intentMatch, Option(res), ctx)
 
         flow.synchronized {
             val buf = flow.getOrElseUpdate(ctx.getRequest.getUserId, 
mutable.ArrayBuffer.empty[NCDialogFlowItem])
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/impl/NCModelScanner.scala
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/impl/NCModelScanner.scala
index ac306bce..14a58aab 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/impl/NCModelScanner.scala
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/impl/NCModelScanner.scala
@@ -407,11 +407,8 @@ object NCModelScanner extends LazyLogging:
 
         val allParamTypes = method.getParameterTypes.toList
 
-        // TODO: texts
-        if allParamTypes.size < 2 then E(s"Unexpected parameters count for $I 
annotated method [count=${allParamTypes.size}, method=$z]")
-        // TODO: texts
+        if allParamTypes.sizeIs < 2 then E(s"Unexpected parameters count for 
$I annotated method [count=${allParamTypes.size}, method=$z]")
         if allParamTypes.head != CLS_CTX then E(s"First parameter for $I 
annotated method must be NCContext [method=$z]")
-        // TODO: texts
         if allParamTypes(1) != CLS_INTENT_MATCH then E(s"Second parameter for 
$I annotated method must be NCIntentMatch [method=$z]")
 
         val tokParamAnns = 
method.getParameterAnnotations.toList.drop(2).filter(_ != null)
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/intent/matcher/NCIntentSolverManager.scala
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/intent/matcher/NCIntentSolverManager.scala
index ed191ed1..4637a01f 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/intent/matcher/NCIntentSolverManager.scala
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/intent/matcher/NCIntentSolverManager.scala
@@ -740,7 +740,7 @@ class NCIntentSolverManager(
                     typ match
                         case REGULAR =>
                             val cbRes = executeCallback(NCCallbackInput(ctx, 
im))
-                            saveHistory(Some(cbRes), im)
+                            saveHistory(Option(cbRes), im)
                             Loop.finish(IterationResult(Left(cbRes), im))
                         case SEARCH =>
                             saveHistory(None, im)

Reply via email to