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

sergeykamov 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 0475ddde Examples initial scaladoc.
0475ddde is described below

commit 0475ddde689dd3f4531db31de7daf718040434c8
Author: Sergey Kamov <[email protected]>
AuthorDate: Sat Jan 14 13:01:55 2023 +0400

    Examples initial scaladoc.
---
 .../nlpcraft/examples/time/CalculatorModel.scala   | 19 ++++++++++---
 .../examples/lightswitch/LightSwitchFrModel.scala  |  8 +++---
 .../entity/parser/NCFrSemanticEntityParser.scala   |  7 ++---
 .../token/enricher/NCFrLemmaPosTokenEnricher.scala |  6 ++++-
 .../enricher/NCFrStopWordsTokenEnricher.scala      |  3 +++
 .../nlp/token/parser/NCFrTokenParser.scala         |  3 ++-
 .../examples/lightswitch/LightSwitchRuModel.scala  |  8 ++++++
 .../entity/parser/NCRuSemanticEntityParser.scala   |  7 ++---
 .../token/enricher/NCRuLemmaPosTokenEnricher.scala |  6 ++++-
 .../enricher/NCRuStopWordsTokenEnricher.scala      |  3 +++
 .../nlp/token/parser/NCRuTokenParser.scala         |  3 ++-
 .../examples/lightswitch/LightSwitchModel.scala    |  8 +++---
 .../nlpcraft/examples/pizzeria/PizzeriaModel.scala | 31 +++++++++++++++++-----
 .../nlpcraft/examples/pizzeria/PizzeriaOrder.scala |  8 +++---
 .../components/PizzeriaModelPipeline.scala         |  6 +++--
 .../pizzeria/components/PizzeriaOrderMapper.scala  | 14 +++++++++-
 .../components/PizzeriaOrderValidator.scala        |  4 ++-
 .../examples/pizzeria/PizzeriaModelSpec.scala      |  3 ++-
 .../apache/nlpcraft/examples/time/TimeModel.scala  | 11 +++++++-
 .../time/utils/cities/CitiesDataProvider.scala     |  6 ++---
 .../examples/time/utils/keycdn/GeoManager.scala    |  8 +++---
 21 files changed, 126 insertions(+), 46 deletions(-)

diff --git 
a/nlpcraft-examples/calculator/src/main/scala/org/apache/nlpcraft/examples/time/CalculatorModel.scala
 
b/nlpcraft-examples/calculator/src/main/scala/org/apache/nlpcraft/examples/time/CalculatorModel.scala
index 8572e02e..96f17fae 100644
--- 
a/nlpcraft-examples/calculator/src/main/scala/org/apache/nlpcraft/examples/time/CalculatorModel.scala
+++ 
b/nlpcraft-examples/calculator/src/main/scala/org/apache/nlpcraft/examples/time/CalculatorModel.scala
@@ -26,9 +26,9 @@ import java.util.Properties
 import scala.annotation.*
 
 /**
- *
+ * Companion helper.
  */
-object CalculatorModel:
+private object CalculatorModel:
     private val OPS: Map[String, (Int, Int) => Int] = Map("+" -> (_ + _), "-" 
-> (_ - _), "*" -> (_ * _), "/" -> (_ / _))
     private val PIPELINE: NCPipeline =
         val props = new Properties()
@@ -47,8 +47,19 @@ object CalculatorModel:
 import CalculatorModel.*
 
 /**
- * 
- */
+  * This example provides very simple implementation for NLI-powered 
calculator with memory of last operation result function.
+  *
+  * Supported operations are: `+`, `-`, `*` and `/`.
+  * Operands values can be given as digits or in text.
+  * When first operand is omitted than last operation result is used instead 
of first.
+  *
+  * You can ask something like this:
+  * - User input: *2 + 2*. Expected result is **4**.
+  * - User input: *twenty two - two*. Expected result is **20**.
+  * - User input: *\/ two*. Expected result is **10**.
+  *
+  * See 'README.md' file in the same folder for running and testing 
instructions.
+  */
 class CalculatorModel extends NCModel(NCModelConfig("nlpcraft.calculator.ex", 
"Calculator Example Model", "1.0"), PIPELINE):
     private var mem: Option[Int] = None
 
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 a434295d..8cd4b29f 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
@@ -27,11 +27,11 @@ import scala.jdk.CollectionConverters.*
 
 /**
   * This example provides very simple implementation for NLI-powered light 
switch.
+  *
   * You can say something like this:
-  * <ul>
-  *     <li>"Turn the lights off in the entire house."</li>
-  *     <li>"Switch on the illumination in the master bedroom closet."</li>
-  * </ul>
+  * - Éteignez les lumières dans toute la maison.
+  * - S'il te plaît, pas de lumières!
+  *
   * You can easily modify intent callbacks to perform the actual light 
switching using
   * HomeKit or Arduino-based controllers.
   *
diff --git 
a/nlpcraft-examples/lightswitch-fr/src/main/scala/org/apache/nlpcraft/examples/lightswitch/nlp/entity/parser/NCFrSemanticEntityParser.scala
 
b/nlpcraft-examples/lightswitch-fr/src/main/scala/org/apache/nlpcraft/examples/lightswitch/nlp/entity/parser/NCFrSemanticEntityParser.scala
index 8252468d..9311625f 100644
--- 
a/nlpcraft-examples/lightswitch-fr/src/main/scala/org/apache/nlpcraft/examples/lightswitch/nlp/entity/parser/NCFrSemanticEntityParser.scala
+++ 
b/nlpcraft-examples/lightswitch-fr/src/main/scala/org/apache/nlpcraft/examples/lightswitch/nlp/entity/parser/NCFrSemanticEntityParser.scala
@@ -24,14 +24,15 @@ import org.apache.nlpcraft.nlp.stemmer.NCStemmer
 import org.apache.nlpcraft.nlp.parsers.*
 
 /**
+  * Extension of [[NCSemanticEntityParser]] for FR language.
   *
-  * @param src
+  * @param mdlRes Relative path, absolute path, classpath resource or URL to 
YAML or JSON semantic model definition.
   */
-class NCFrSemanticEntityParser(src: String) extends NCSemanticEntityParser(
+class NCFrSemanticEntityParser(mdlRes: String) extends NCSemanticEntityParser(
     new NCStemmer:
         private val stemmer = new 
SnowballStemmer(SnowballStemmer.ALGORITHM.FRENCH)
         override def stem(word: String): String = stemmer.synchronized { 
stemmer.stem(word.toLowerCase).toString }
     ,
     new NCFrTokenParser(),
-    src
+    mdlRes
 )
diff --git 
a/nlpcraft-examples/lightswitch-fr/src/main/scala/org/apache/nlpcraft/examples/lightswitch/nlp/token/enricher/NCFrLemmaPosTokenEnricher.scala
 
b/nlpcraft-examples/lightswitch-fr/src/main/scala/org/apache/nlpcraft/examples/lightswitch/nlp/token/enricher/NCFrLemmaPosTokenEnricher.scala
index b4a783be..ef469eb5 100644
--- 
a/nlpcraft-examples/lightswitch-fr/src/main/scala/org/apache/nlpcraft/examples/lightswitch/nlp/token/enricher/NCFrLemmaPosTokenEnricher.scala
+++ 
b/nlpcraft-examples/lightswitch-fr/src/main/scala/org/apache/nlpcraft/examples/lightswitch/nlp/token/enricher/NCFrLemmaPosTokenEnricher.scala
@@ -23,11 +23,15 @@ import org.languagetool.tagging.fr.FrenchTagger
 import scala.jdk.CollectionConverters.*
 
 /**
-  *
+  * [[https://languagetool.org/ Language Tool]] based FR language 
[[NCTokenEnricher token enricher]]. This
+  * enricher adds `lemma` and `pos` (part-of-speech) string [[NCPropertyMap 
metadata]] property to the [[NCToken token]]
+  * instance. Learn more about lemmas 
[[https://en.wikipedia.org/wiki/Lemma_(morphology) here]] and about 
part-of-speech
+  * 
[[https://www.ling.upenn.edu/courses/Fall_2003/ling001/penn_treebank_pos.html 
here]].
   */
 class NCFrLemmaPosTokenEnricher extends NCTokenEnricher:
     private def nvl(v: String, dflt : => String): String = if v != null then v 
else dflt
 
+    /** @inheritdoc */
     override def enrich(req: NCRequest, cfg: NCModelConfig, toks: 
List[NCToken]): Unit =
         val tags = 
FrenchTagger.INSTANCE.tag(toks.map(_.getText).asJava).asScala
 
diff --git 
a/nlpcraft-examples/lightswitch-fr/src/main/scala/org/apache/nlpcraft/examples/lightswitch/nlp/token/enricher/NCFrStopWordsTokenEnricher.scala
 
b/nlpcraft-examples/lightswitch-fr/src/main/scala/org/apache/nlpcraft/examples/lightswitch/nlp/token/enricher/NCFrStopWordsTokenEnricher.scala
index afb712d2..45bcac07 100644
--- 
a/nlpcraft-examples/lightswitch-fr/src/main/scala/org/apache/nlpcraft/examples/lightswitch/nlp/token/enricher/NCFrStopWordsTokenEnricher.scala
+++ 
b/nlpcraft-examples/lightswitch-fr/src/main/scala/org/apache/nlpcraft/examples/lightswitch/nlp/token/enricher/NCFrStopWordsTokenEnricher.scala
@@ -21,7 +21,9 @@ import org.apache.lucene.analysis.fr.FrenchAnalyzer
 import org.apache.nlpcraft.*
 
 /**
+  * FR language stop words [[NCTokenEnricher]] implementation based on 
[[https://lucene.apache.org/ Apache Lucene Library]].
   *
+  * More information about stopwords can be found at 
[[https://en.wikipedia.org/wiki/Stop_word]]
   */
 class NCFrStopWordsTokenEnricher extends NCTokenEnricher:
     private final val stops = FrenchAnalyzer.getDefaultStopSet
@@ -29,6 +31,7 @@ class NCFrStopWordsTokenEnricher extends NCTokenEnricher:
     private def getPos(t: NCToken): String = t.get("pos").getOrElse(throw new 
NCException("POS not found in token."))
     private def getLemma(t: NCToken): String = t.get("lemma").getOrElse(throw 
new NCException("Lemma not found in token."))
 
+    /** @inheritdoc */
     override def enrich(req: NCRequest, cfg: NCModelConfig, toks: 
List[NCToken]): Unit =
         for (t <- toks)
             val lemma = getLemma(t)
diff --git 
a/nlpcraft-examples/lightswitch-fr/src/main/scala/org/apache/nlpcraft/examples/lightswitch/nlp/token/parser/NCFrTokenParser.scala
 
b/nlpcraft-examples/lightswitch-fr/src/main/scala/org/apache/nlpcraft/examples/lightswitch/nlp/token/parser/NCFrTokenParser.scala
index 9cdf2835..fadce159 100644
--- 
a/nlpcraft-examples/lightswitch-fr/src/main/scala/org/apache/nlpcraft/examples/lightswitch/nlp/token/parser/NCFrTokenParser.scala
+++ 
b/nlpcraft-examples/lightswitch-fr/src/main/scala/org/apache/nlpcraft/examples/lightswitch/nlp/token/parser/NCFrTokenParser.scala
@@ -22,11 +22,12 @@ import org.languagetool.tokenizers.fr.FrenchWordTokenizer
 import scala.jdk.CollectionConverters.*
 
 /**
-  *
+  * [[https://languagetool.org/ Language Tool]] based FR language 
[[NCTokenParser entity parser]].
   */
 class NCFrTokenParser extends NCTokenParser:
     private val tokenizer = new FrenchWordTokenizer
 
+    /** @inheritdoc */
     override def tokenize(text: String): List[NCToken] =
         val toks = collection.mutable.ArrayBuffer.empty[NCToken]
         var sumLen = 0
diff --git 
a/nlpcraft-examples/lightswitch-ru/src/main/scala/org/apache/nlpcraft/examples/lightswitch/LightSwitchRuModel.scala
 
b/nlpcraft-examples/lightswitch-ru/src/main/scala/org/apache/nlpcraft/examples/lightswitch/LightSwitchRuModel.scala
index 17c7215f..efa272b1 100644
--- 
a/nlpcraft-examples/lightswitch-ru/src/main/scala/org/apache/nlpcraft/examples/lightswitch/LightSwitchRuModel.scala
+++ 
b/nlpcraft-examples/lightswitch-ru/src/main/scala/org/apache/nlpcraft/examples/lightswitch/LightSwitchRuModel.scala
@@ -28,6 +28,14 @@ import 
org.apache.nlpcraft.examples.lightswitch.nlp.token.parser.NCRuTokenParser
 import scala.jdk.CollectionConverters.*
 
 /**
+  * This example provides very simple implementation for NLI-powered light 
switch.
+  *
+  * You can say something like this:
+  * - Выключи свет по всем домe.
+  * - Отключи электричество в ванной.
+  *
+  * You can easily modify intent callbacks to perform the actual light 
switching using
+  * HomeKit or Arduino-based controllers.
   *
   * See 'README.md' file in the same folder for running and testing 
instructions.
   */
diff --git 
a/nlpcraft-examples/lightswitch-ru/src/main/scala/org/apache/nlpcraft/examples/lightswitch/nlp/entity/parser/NCRuSemanticEntityParser.scala
 
b/nlpcraft-examples/lightswitch-ru/src/main/scala/org/apache/nlpcraft/examples/lightswitch/nlp/entity/parser/NCRuSemanticEntityParser.scala
index 775a5ccf..1fb634cc 100644
--- 
a/nlpcraft-examples/lightswitch-ru/src/main/scala/org/apache/nlpcraft/examples/lightswitch/nlp/entity/parser/NCRuSemanticEntityParser.scala
+++ 
b/nlpcraft-examples/lightswitch-ru/src/main/scala/org/apache/nlpcraft/examples/lightswitch/nlp/entity/parser/NCRuSemanticEntityParser.scala
@@ -24,14 +24,15 @@ import org.apache.nlpcraft.*
 import org.apache.nlpcraft.nlp.stemmer.NCStemmer
 
 /**
+  * Extension of [[NCSemanticEntityParser]] for RU language.
   *
-  * @param src
+  * @param mdlRes Relative path, absolute path, classpath resource or URL to 
YAML or JSON semantic model definition.
   */
-class NCRuSemanticEntityParser(src: String) extends NCSemanticEntityParser(
+class NCRuSemanticEntityParser(mdlRes: String) extends NCSemanticEntityParser(
     new NCStemmer:
         private val stemmer = new 
SnowballStemmer(SnowballStemmer.ALGORITHM.RUSSIAN)
         override def stem(word: String): String = stemmer.synchronized { 
stemmer.stem(word.toLowerCase).toString }
     ,
     new NCRuTokenParser(),
-    src
+    mdlRes
 )
diff --git 
a/nlpcraft-examples/lightswitch-ru/src/main/scala/org/apache/nlpcraft/examples/lightswitch/nlp/token/enricher/NCRuLemmaPosTokenEnricher.scala
 
b/nlpcraft-examples/lightswitch-ru/src/main/scala/org/apache/nlpcraft/examples/lightswitch/nlp/token/enricher/NCRuLemmaPosTokenEnricher.scala
index 2251a496..c9a79ba6 100644
--- 
a/nlpcraft-examples/lightswitch-ru/src/main/scala/org/apache/nlpcraft/examples/lightswitch/nlp/token/enricher/NCRuLemmaPosTokenEnricher.scala
+++ 
b/nlpcraft-examples/lightswitch-ru/src/main/scala/org/apache/nlpcraft/examples/lightswitch/nlp/token/enricher/NCRuLemmaPosTokenEnricher.scala
@@ -23,11 +23,15 @@ import org.languagetool.tagging.ru.RussianTagger
 import scala.jdk.CollectionConverters.*
 
 /**
-  *
+  * [[https://languagetool.org/ Language Tool]] based RU language 
[[NCTokenEnricher token enricher]]. This
+  * enricher adds `lemma` and `pos` (part-of-speech) string [[NCPropertyMap 
metadata]] property to the [[NCToken token]]
+  * instance. Learn more about lemmas 
[[https://en.wikipedia.org/wiki/Lemma_(morphology) here]] and about 
part-of-speech
+  * 
[[https://www.ling.upenn.edu/courses/Fall_2003/ling001/penn_treebank_pos.html 
here]].
   */
 class NCRuLemmaPosTokenEnricher extends NCTokenEnricher:
     private def nvl(v: String, dflt : => String): String = if v != null then v 
else dflt
 
+    /** @inheritdoc */
     override def enrich(req: NCRequest, cfg: NCModelConfig, toks: 
List[NCToken]): Unit =
         val tags = 
RussianTagger.INSTANCE.tag(toks.map(_.getText).asJava).asScala
 
diff --git 
a/nlpcraft-examples/lightswitch-ru/src/main/scala/org/apache/nlpcraft/examples/lightswitch/nlp/token/enricher/NCRuStopWordsTokenEnricher.scala
 
b/nlpcraft-examples/lightswitch-ru/src/main/scala/org/apache/nlpcraft/examples/lightswitch/nlp/token/enricher/NCRuStopWordsTokenEnricher.scala
index 7871450f..b143feac 100644
--- 
a/nlpcraft-examples/lightswitch-ru/src/main/scala/org/apache/nlpcraft/examples/lightswitch/nlp/token/enricher/NCRuStopWordsTokenEnricher.scala
+++ 
b/nlpcraft-examples/lightswitch-ru/src/main/scala/org/apache/nlpcraft/examples/lightswitch/nlp/token/enricher/NCRuStopWordsTokenEnricher.scala
@@ -21,7 +21,9 @@ import org.apache.lucene.analysis.ru.RussianAnalyzer
 import org.apache.nlpcraft.*
 
 /**
+  * RU language stop words [[NCTokenEnricher]] implementation based on 
[[https://lucene.apache.org/ Apache Lucene Library]].
   *
+  * More information about stopwords can be found at 
[[https://en.wikipedia.org/wiki/Stop_word]]
   */
 class NCRuStopWordsTokenEnricher extends NCTokenEnricher:
     private final val stops = RussianAnalyzer.getDefaultStopSet
@@ -29,6 +31,7 @@ class NCRuStopWordsTokenEnricher extends NCTokenEnricher:
     private def getPos(t: NCToken): String = t.get("pos").getOrElse(throw new 
NCException("POS not found in token."))
     private def getLemma(t: NCToken): String = t.get("lemma").getOrElse(throw 
new NCException("Lemma not found in token."))
 
+    /** @inheritdoc */
     override def enrich(req: NCRequest, cfg: NCModelConfig, toks: 
List[NCToken]): Unit =
         for (t <- toks)
             val lemma = getLemma(t)
diff --git 
a/nlpcraft-examples/lightswitch-ru/src/main/scala/org/apache/nlpcraft/examples/lightswitch/nlp/token/parser/NCRuTokenParser.scala
 
b/nlpcraft-examples/lightswitch-ru/src/main/scala/org/apache/nlpcraft/examples/lightswitch/nlp/token/parser/NCRuTokenParser.scala
index af31fff9..7ccf4473 100644
--- 
a/nlpcraft-examples/lightswitch-ru/src/main/scala/org/apache/nlpcraft/examples/lightswitch/nlp/token/parser/NCRuTokenParser.scala
+++ 
b/nlpcraft-examples/lightswitch-ru/src/main/scala/org/apache/nlpcraft/examples/lightswitch/nlp/token/parser/NCRuTokenParser.scala
@@ -23,11 +23,12 @@ import org.languagetool.tokenizers.WordTokenizer
 import scala.jdk.CollectionConverters.*
 
 /**
-  *
+  * [[https://languagetool.org/ Language Tool]] based RU language 
[[NCTokenParser entity parser]].
   */
 class NCRuTokenParser extends NCTokenParser:
     private val tokenizer = new WordTokenizer
 
+    /** @inheritdoc */
     override def tokenize(text: String): List[NCToken] =
         val toks = collection.mutable.ArrayBuffer.empty[NCToken]
         var sumLen = 0
diff --git 
a/nlpcraft-examples/lightswitch/src/main/scala/org/apache/nlpcraft/examples/lightswitch/LightSwitchModel.scala
 
b/nlpcraft-examples/lightswitch/src/main/scala/org/apache/nlpcraft/examples/lightswitch/LightSwitchModel.scala
index 2085bfd4..853fdee2 100644
--- 
a/nlpcraft-examples/lightswitch/src/main/scala/org/apache/nlpcraft/examples/lightswitch/LightSwitchModel.scala
+++ 
b/nlpcraft-examples/lightswitch/src/main/scala/org/apache/nlpcraft/examples/lightswitch/LightSwitchModel.scala
@@ -26,11 +26,11 @@ import 
org.apache.nlpcraft.nlp.parsers.{NCOpenNLPTokenParser, NCSemanticEntityPa
 
 /**
   * This example provides very simple implementation for NLI-powered light 
switch.
+  *
   * You can say something like this:
-  * <ul>
-  *     <li>"Turn the lights off in the entire house."</li>
-  *     <li>"Switch on the illumination in the master bedroom closet."</li>
-  * </ul>
+  * - Turn the lights off in the entire house.
+  * - Switch on the illumination in the master bedroom closet.
+  *
   * You can easily modify intent callbacks to perform the actual light 
switching using
   * HomeKit or Arduino-based controllers.
   *
diff --git 
a/nlpcraft-examples/pizzeria/src/main/scala/org/apache/nlpcraft/examples/pizzeria/PizzeriaModel.scala
 
b/nlpcraft-examples/pizzeria/src/main/scala/org/apache/nlpcraft/examples/pizzeria/PizzeriaModel.scala
index 4539174e..d45d59f9 100644
--- 
a/nlpcraft-examples/pizzeria/src/main/scala/org/apache/nlpcraft/examples/pizzeria/PizzeriaModel.scala
+++ 
b/nlpcraft-examples/pizzeria/src/main/scala/org/apache/nlpcraft/examples/pizzeria/PizzeriaModel.scala
@@ -26,7 +26,11 @@ import 
org.apache.nlpcraft.examples.pizzeria.PizzeriaOrderState.*
 import org.apache.nlpcraft.examples.pizzeria.components.PizzeriaModelPipeline
 import org.apache.nlpcraft.nlp.*
 
-object PizzeriaExtractors:
+
+/**
+  * Extractors.
+  */
+private object PizzeriaExtractors:
     def extractPizzaSize(e: NCEntity): String = 
e[String]("ord:pizza:size:value")
     def extractQty(e: NCEntity, qty: String): Option[Int] = 
Option.when(e.contains(qty))(e[String](qty).toDouble.toInt)
     def extractPizza(e: NCEntity): Pizza =
@@ -37,9 +41,9 @@ object PizzeriaExtractors:
 import PizzeriaExtractors.*
 
 /**
-  * * Pizza model helper.
+  * Companion helper.
   */
-object PizzeriaModel extends LazyLogging:
+private object PizzeriaModel extends LazyLogging:
     type Result = (NCResult, State)
     private val UNEXPECTED_REQUEST = new NCRejection("Unexpected request for 
current dialog context.")
 
@@ -117,10 +121,23 @@ object PizzeriaModel extends LazyLogging:
 import org.apache.nlpcraft.examples.pizzeria.PizzeriaModel.*
 
 /**
-  * Pizza model.
-  * It keep order state for each user.
-  * Each order can in one of 5 state 
(org.apache.nlpcraft.examples.pizzeria.OrderState)
-  * Note that there is used custom states logic instead of STM, because 
complex states flow.
+  * This example provides simple implementation for NLI-powered pizzeria order 
bot.
+  * This is single user implementation with user order state support.
+  * Bot can send dialog answers, ask to specify order or confirm order 
execution.
+  *
+  * Dialog example:
+  *  - User: *I want to order carbonara, marinara and tea*
+  *  - Bot:  *Choose size (large, medium or small) for: 'carbonara'*
+  *  - User: *large size please*
+  *  - Bot:  *Choose size (large, medium or small) for: 'marinara'*
+  *  - User: *smallest*
+  *  - Bot:  *Is order ready?*
+  *  - User: *yes*
+  *  - Bot:  *Let's specify your order: pizza: carbonara 'large' 1 pcs, 
marinara 'small' 1 pcs, drinks: tea 1 pcs. Is it correct?*
+  *  - User: *correct*
+  *  - Bot:  *Executed: pizza: carbonara 'large' 1 pcs, marinara 'small' 1 
pcs, drinks: tea 1 pcs.*
+  *
+  * See 'README.md' file in the same folder for running and testing 
instructions.
   */
 class PizzeriaModel extends NCModel(NCModelConfig("nlpcraft.pizzeria.ex", 
"Pizzeria Example Model", "1.0"), PizzeriaModelPipeline.PIPELINE) with 
LazyLogging:
     // This method is defined in class scope and has package access level for 
tests reasons.
diff --git 
a/nlpcraft-examples/pizzeria/src/main/scala/org/apache/nlpcraft/examples/pizzeria/PizzeriaOrder.scala
 
b/nlpcraft-examples/pizzeria/src/main/scala/org/apache/nlpcraft/examples/pizzeria/PizzeriaOrder.scala
index 5a622dd3..1cd14500 100644
--- 
a/nlpcraft-examples/pizzeria/src/main/scala/org/apache/nlpcraft/examples/pizzeria/PizzeriaOrder.scala
+++ 
b/nlpcraft-examples/pizzeria/src/main/scala/org/apache/nlpcraft/examples/pizzeria/PizzeriaOrder.scala
@@ -23,7 +23,7 @@ import org.apache.nlpcraft.*
 /**
   * Order states.
   */
-enum PizzeriaOrderState:
+private [pizzeria] enum PizzeriaOrderState:
     case DIALOG_EMPTY, DIALOG_IS_READY, DIALOG_SHOULD_CANCEL, DIALOG_SPECIFY, 
DIALOG_CONFIRM
 
 private object OrderPosition:
@@ -43,7 +43,7 @@ private trait OrderPosition:
   * @param size Optional size.
   * @param qty Optional quantity.
   */
-case class Pizza(name: String, var size: Option[String], var qty: Option[Int]) 
extends OrderPosition:
+private [pizzeria] case class Pizza(name: String, var size: Option[String], 
var qty: Option[Int]) extends OrderPosition:
     override def toString = s"$name '${size.getOrElse("undefined size")}' 
${qty.getOrElse(OrderPosition.DFLT_QTY)} pcs"
 
 /**
@@ -52,7 +52,7 @@ case class Pizza(name: String, var size: Option[String], var 
qty: Option[Int]) e
   * @param name Name.
   * @param qty Optional quantity.
   */
-case class Drink(name: String, var qty: Option[Int]) extends OrderPosition:
+private [pizzeria] case class Drink(name: String, var qty: Option[Int]) 
extends OrderPosition:
     override def toString = s"$name ${qty.getOrElse(OrderPosition.DFLT_QTY)} 
pcs"
 
 import org.apache.nlpcraft.examples.pizzeria.PizzeriaOrderState.*
@@ -60,7 +60,7 @@ import 
org.apache.nlpcraft.examples.pizzeria.PizzeriaOrderState.*
 /**
   * Order.
   */
-class PizzeriaOrder:
+private [pizzeria] class PizzeriaOrder:
     private var state = DIALOG_EMPTY
     private val pizzas = mutable.ArrayBuffer.empty[Pizza]
     private val drinks = mutable.ArrayBuffer.empty[Drink]
diff --git 
a/nlpcraft-examples/pizzeria/src/main/scala/org/apache/nlpcraft/examples/pizzeria/components/PizzeriaModelPipeline.scala
 
b/nlpcraft-examples/pizzeria/src/main/scala/org/apache/nlpcraft/examples/pizzeria/components/PizzeriaModelPipeline.scala
index 4735f476..d591dc2f 100644
--- 
a/nlpcraft-examples/pizzeria/src/main/scala/org/apache/nlpcraft/examples/pizzeria/components/PizzeriaModelPipeline.scala
+++ 
b/nlpcraft-examples/pizzeria/src/main/scala/org/apache/nlpcraft/examples/pizzeria/components/PizzeriaModelPipeline.scala
@@ -12,8 +12,10 @@ import org.apache.nlpcraft.nlp.parsers.NCSemanticEntityParser
 import java.util.Properties
 
 /**
-  * PizzeriaModel pipeline, based on Stanford NLP engine, including model 
custom components. */
-object PizzeriaModelPipeline:
+  * PizzeriaModel pipeline, based on Stanford NLP engine, including model 
custom components.
+  */
+private [pizzeria] object PizzeriaModelPipeline:
+    /** Prepared pipeline instance.*/
     val PIPELINE: NCPipeline =
         val stanford =
             val props = new Properties()
diff --git 
a/nlpcraft-examples/pizzeria/src/main/scala/org/apache/nlpcraft/examples/pizzeria/components/PizzeriaOrderMapper.scala
 
b/nlpcraft-examples/pizzeria/src/main/scala/org/apache/nlpcraft/examples/pizzeria/components/PizzeriaOrderMapper.scala
index 19fd03c6..77179afa 100644
--- 
a/nlpcraft-examples/pizzeria/src/main/scala/org/apache/nlpcraft/examples/pizzeria/components/PizzeriaOrderMapper.scala
+++ 
b/nlpcraft-examples/pizzeria/src/main/scala/org/apache/nlpcraft/examples/pizzeria/components/PizzeriaOrderMapper.scala
@@ -24,6 +24,7 @@ import org.apache.nlpcraft.NCResultType.ASK_DIALOG
 import scala.collection.*
 
 /**
+  * Element description holder.
   *
   * @param elementType Element type.
   * @param propertyName Element's property name.
@@ -41,7 +42,7 @@ case class PizzeriaOrderMapperDesc(elementType: String, 
propertyName: String)
   * Note that it is simple example implementation.
   * It just tries to unite nearest neighbours and doesn't check intermediate 
words, order correctness etc.
   */
-object PizzeriaOrderMapper:
+private object PizzeriaOrderMapper:
     extension(entity: NCEntity)
         def position: Double =
             val toks = entity.getTokens
@@ -55,7 +56,18 @@ object PizzeriaOrderMapper:
 
 import PizzeriaOrderMapper.*
 
+/**
+  * Custom [[NCEntityMapper]] implementation. It creates new [[NCEntity]] 
instances
+  * based on `dests` elements extending them by `extra` element property.
+  * If `dests` elements or `extra` element are not found or
+  * `dests` and `extra` elements aren't located side by side in user input
+  * then initial input [[NCEntity]] instances are passed as is.
+  *
+  * @param extra Extra data element description.
+  * @param dests Base elements descriptions.
+  */
 case class PizzeriaOrderMapper(extra: PizzeriaOrderMapperDesc, dests: 
Seq[PizzeriaOrderMapperDesc]) extends NCEntityMapper with LazyLogging:
+    /** @inheritdoc */
     override def map(req: NCRequest, cfg: NCModelConfig, ents: 
List[NCEntity]): List[NCEntity] =
         def map(destEnt: NCEntity, destProp: String, extraEnt: NCEntity): 
NCEntity =
             new NCPropertyMapAdapter with NCEntity:
diff --git 
a/nlpcraft-examples/pizzeria/src/main/scala/org/apache/nlpcraft/examples/pizzeria/components/PizzeriaOrderValidator.scala
 
b/nlpcraft-examples/pizzeria/src/main/scala/org/apache/nlpcraft/examples/pizzeria/components/PizzeriaOrderValidator.scala
index e99faeaa..e42c2e58 100644
--- 
a/nlpcraft-examples/pizzeria/src/main/scala/org/apache/nlpcraft/examples/pizzeria/components/PizzeriaOrderValidator.scala
+++ 
b/nlpcraft-examples/pizzeria/src/main/scala/org/apache/nlpcraft/examples/pizzeria/components/PizzeriaOrderValidator.scala
@@ -20,9 +20,11 @@ package org.apache.nlpcraft.examples.pizzeria.components
 import org.apache.nlpcraft.*
 
 /**
-  * Rejects some invalid variant with more detailed information instead of 
standard rejections.
+  * Custom [[NCEntityValidator]] implementation.
+  * It throws [[NCRejection]] exception on invalid user request which 
simplifies main model logic.
   */
 class PizzeriaOrderValidator extends NCEntityValidator:
+    /** @inheritdoc */
     override def validate(req: NCRequest, cfg: NCModelConfig, ents: 
List[NCEntity]): Unit =
         def count(typ: String): Int = ents.count(_.getType == typ)
 
diff --git 
a/nlpcraft-examples/pizzeria/src/test/scala/org/apache/nlpcraft/examples/pizzeria/PizzeriaModelSpec.scala
 
b/nlpcraft-examples/pizzeria/src/test/scala/org/apache/nlpcraft/examples/pizzeria/PizzeriaModelSpec.scala
index 6f619b60..a8f2f719 100644
--- 
a/nlpcraft-examples/pizzeria/src/test/scala/org/apache/nlpcraft/examples/pizzeria/PizzeriaModelSpec.scala
+++ 
b/nlpcraft-examples/pizzeria/src/test/scala/org/apache/nlpcraft/examples/pizzeria/PizzeriaModelSpec.scala
@@ -28,7 +28,7 @@ import scala.language.implicitConversions
 import scala.util.Using
 import scala.collection.mutable
 
-object PizzeriaModelSpec:
+private object PizzeriaModelSpec:
     type Request = (String, NCResultType)
     private class ModelTestWrapper extends PizzeriaModel:
         private var o: PizzeriaOrder = _
@@ -53,6 +53,7 @@ object PizzeriaModelSpec:
         def build: PizzeriaOrder = o
 
 import PizzeriaModelSpec.*
+
 /**
   *
   */
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 c348a6b8..5826f090 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
@@ -31,7 +31,16 @@ import java.time.format.FormatStyle.MEDIUM
 import java.time.*
 
 /**
-  * Time answering model.
+  * This example provides very simple implementation for NLI-powered time 
answering bot.
+  *
+  * It reports about current time value in asked GEO location or in your local 
area.
+  *
+  * You can ask something like this:
+  * - What time is it now in New York City?
+  * - Can you please give me the Tokyo's current date and time.
+  * - What's the local time?
+  *
+  * See 'README.md' file in the same folder for running and testing 
instructions.
   */
 @NCIntent("fragment=city term(city)~{# == 'opennlp:location'}")
 @NCIntent("intent=intent2 term~{# == 'x:time'} fragment(city)")
diff --git 
a/nlpcraft-examples/time/src/main/scala/org/apache/nlpcraft/examples/time/utils/cities/CitiesDataProvider.scala
 
b/nlpcraft-examples/time/src/main/scala/org/apache/nlpcraft/examples/time/utils/cities/CitiesDataProvider.scala
index 97155720..531f151b 100644
--- 
a/nlpcraft-examples/time/src/main/scala/org/apache/nlpcraft/examples/time/utils/cities/CitiesDataProvider.scala
+++ 
b/nlpcraft-examples/time/src/main/scala/org/apache/nlpcraft/examples/time/utils/cities/CitiesDataProvider.scala
@@ -22,10 +22,10 @@ import java.io.*
 import java.util.Objects
 import scala.util.Using
 
-case class City(name: String, country: String)
-case class CityData(timezone: String, latitude: Double, longitude: Double)
+private[time] case class City(name: String, country: String)
+private[time] case class CityData(timezone: String, latitude: Double, 
longitude: Double)
 
-object CitiesDataProvider:
+private[time] object CitiesDataProvider:
     def get: Map[City, CityData] =
         def convert(arr: Array[String]): (City, CityData) =
             City(arr(0), arr(1)) -> CityData(arr(2), arr(3).toDouble, 
arr(4).toDouble)
diff --git 
a/nlpcraft-examples/time/src/main/scala/org/apache/nlpcraft/examples/time/utils/keycdn/GeoManager.scala
 
b/nlpcraft-examples/time/src/main/scala/org/apache/nlpcraft/examples/time/utils/keycdn/GeoManager.scala
index a51eac73..f66b7433 100644
--- 
a/nlpcraft-examples/time/src/main/scala/org/apache/nlpcraft/examples/time/utils/keycdn/GeoManager.scala
+++ 
b/nlpcraft-examples/time/src/main/scala/org/apache/nlpcraft/examples/time/utils/keycdn/GeoManager.scala
@@ -28,11 +28,11 @@ import scala.io.Source
 import scala.util.Using
 
 // Such field names required by 'keycdn.com' service response.
-case class ResponseGeoData(country_name: String, city: String, latitude: 
Double, longitude: Double, timezone: String)
-case class ResponseData(geo: ResponseGeoData)
-case class Response(status: String, description: String, data: ResponseData)
+private[time] case class ResponseGeoData(country_name: String, city: String, 
latitude: Double, longitude: Double, timezone: String)
+private[time] case class ResponseData(geo: ResponseGeoData)
+private[time] case class Response(status: String, description: String, data: 
ResponseData)
 
-object GeoManager:
+private[time] object GeoManager:
     private val URL: String = "https://tools.keycdn.com/geo.json?host=";
     private val GSON: Gson = new Gson
 

Reply via email to