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

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


The following commit(s) were added to refs/heads/NLPCRAFT-296 by this push:
     new 81a3288  WIP.
81a3288 is described below

commit 81a3288e9b8fa85442d1b0c6e562436059ceac37
Author: unknown <[email protected]>
AuthorDate: Fri May 28 10:55:24 2021 -0700

    WIP.
---
 .../nlp/core/stanford/NCStanfordParser.scala       |  6 ++++--
 .../nlpcraft/common/ascii/NCAsciiTable.scala       |  7 ++++---
 .../nlpcraft/common/config/NCConfigurable.scala    |  4 +++-
 .../nlpcraft/common/nlp/NCNlpSentenceNote.scala    |  8 +++++---
 .../nlpcraft/common/nlp/NCNlpSentenceToken.scala   |  5 +++--
 .../apache/nlpcraft/model/impl/NCTokenImpl.scala   |  8 +++++---
 .../apache/nlpcraft/model/impl/NCTokenLogger.scala | 24 ++++++++++++----------
 .../apache/nlpcraft/model/impl/NCTokenPimp.scala   |  4 +++-
 .../model/intent/solver/NCIntentSolver.scala       |  8 +++++---
 .../model/intent/solver/NCIntentSolverEngine.scala |  6 ++++--
 .../nlpcraft/probe/mgrs/cmd/NCCommandManager.scala |  4 +++-
 .../mgrs/nlp/enrichers/limit/NCLimitEnricher.scala |  4 +++-
 .../enrichers/relation/NCRelationEnricher.scala    |  4 +++-
 .../probe/mgrs/sentence/NCSentenceManager.scala    |  8 ++++----
 .../server/nlp/enrichers/date/NCDateEnricher.scala |  6 ++++--
 .../server/nlp/enrichers/date/NCDateRange.scala    |  5 +++--
 .../server/sugsyn/NCSuggestSynonymResult.scala     |  6 ++++--
 .../nlpcraft/model/dialog/NCDialogSpec.scala       | 14 +++++++------
 .../nlpcraft/model/dialog/NCDialogSpec2.scala      |  9 ++++----
 .../mgrs/nlp/enrichers/NCEnrichersTestBeans.scala  | 14 +++++++------
 .../nlpcraft/server/rest/NCRestModelSpec.scala     |  8 +++++---
 .../apache/nlpcraft/server/rest/NCRestSpec.scala   |  6 ++++--
 22 files changed, 103 insertions(+), 65 deletions(-)

diff --git 
a/nlpcraft-stanford/src/main/scala/org/apache/nlpcraft/server/nlp/core/stanford/NCStanfordParser.scala
 
b/nlpcraft-stanford/src/main/scala/org/apache/nlpcraft/server/nlp/core/stanford/NCStanfordParser.scala
index 1449fdf..ec32bdb 100644
--- 
a/nlpcraft-stanford/src/main/scala/org/apache/nlpcraft/server/nlp/core/stanford/NCStanfordParser.scala
+++ 
b/nlpcraft-stanford/src/main/scala/org/apache/nlpcraft/server/nlp/core/stanford/NCStanfordParser.scala
@@ -26,6 +26,8 @@ import org.apache.nlpcraft.common.{NCE, NCService}
 import org.apache.nlpcraft.server.ignite.NCIgniteInstance
 import org.apache.nlpcraft.server.nlp.core.{NCNlpParser, NCNlpWord}
 
+import java.util.{List => JList}
+
 import scala.jdk.CollectionConverters.ListHasAsScala
 
 /**
@@ -63,13 +65,13 @@ object NCStanfordParser extends NCService with NCNlpParser 
with NCIgniteInstance
 
     override def parse(normTxt: String, parent: Span = null): Seq[NCNlpWord] =
         startScopedSpan("enrich", parent, "normTxt" -> normTxt) { _ =>
-            val a: java.util.List[CoreMap] = 
NCStanfordCoreManager.annotate(normTxt).annotation().get(classOf[SentencesAnnotation])
+            val a: JList[CoreMap] = 
NCStanfordCoreManager.annotate(normTxt).annotation().get(classOf[SentencesAnnotation])
     
             if (a == null)
                 throw new NCE("Sentence annotation not found.")
     
             a.asScala.flatMap(p => {
-                val value: java.util.List[CoreLabel] = 
p.asInstanceOf[ArrayCoreMap].get(classOf[TokensAnnotation])
+                val value: JList[CoreLabel] = 
p.asInstanceOf[ArrayCoreMap].get(classOf[TokensAnnotation])
     
                 value.asScala
             }).map(t => {
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/common/ascii/NCAsciiTable.scala 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/common/ascii/NCAsciiTable.scala
index 52051eb..812e7d0 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/common/ascii/NCAsciiTable.scala
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/common/ascii/NCAsciiTable.scala
@@ -18,6 +18,7 @@
 package org.apache.nlpcraft.common.ascii
 
 import java.io.{IOException, PrintStream}
+import java.util.{List => JList}
 import com.typesafe.scalalogging.Logger
 import org.apache.nlpcraft.common._
 import org.apache.nlpcraft.common.ascii.NCAsciiTable._
@@ -235,7 +236,7 @@ class NCAsciiTable {
      *
      * @param cells Row cells.
      */
-    def addRow(cells: java.util.List[Any]): NCAsciiTable = {
+    def addRow(cells: JList[Any]): NCAsciiTable = {
         startRow()
 
         cells.asScala.foreach(p => addRowCell(p))
@@ -286,7 +287,7 @@ class NCAsciiTable {
      *
      * @param cells Header cells.
      */
-    def addHeaders(cells: java.util.List[Any]): NCAsciiTable = {
+    def addHeaders(cells: JList[Any]): NCAsciiTable = {
         cells.asScala.foreach(addHeaderCell(_))
 
         this
@@ -298,7 +299,7 @@ class NCAsciiTable {
      * @param style Style top use.
      * @param cells Header cells.
      */
-    def addStyledHeaders(style: String, cells: java.util.List[Any]): 
NCAsciiTable = {
+    def addStyledHeaders(style: String, cells: JList[Any]): NCAsciiTable = {
         cells.asScala.foreach(addHeaderCell(style, _))
 
         this
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/common/config/NCConfigurable.scala
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/common/config/NCConfigurable.scala
index d4351ee..bc0ccfe 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/common/config/NCConfigurable.scala
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/common/config/NCConfigurable.scala
@@ -21,8 +21,10 @@ import com.typesafe.config.{Config, ConfigFactory}
 import com.typesafe.scalalogging.LazyLogging
 import org.apache.nlpcraft.common._
 
+import java.util.{List => JList}
 import java.io.File
 import java.net.{MalformedURLException, URL}
+
 import scala.jdk.CollectionConverters.MapHasAsScala
 
 /**
@@ -107,7 +109,7 @@ trait NCConfigurable {
       *
       * @param name Full configuration property path (name).
       */
-    def getLongList(name: String): java.util.List[java.lang.Long] = {
+    def getLongList(name: String): JList[java.lang.Long] = {
         checkMandatory(name)
         
         hocon.getLongList(name)
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/common/nlp/NCNlpSentenceNote.scala
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/common/nlp/NCNlpSentenceNote.scala
index 5675656..8e3fb10 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/common/nlp/NCNlpSentenceNote.scala
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/common/nlp/NCNlpSentenceNote.scala
@@ -21,6 +21,8 @@ import org.apache.nlpcraft.common.U
 import org.apache.nlpcraft.common.ascii._
 
 import java.io.{Serializable => JSerializable}
+import java.util.{List => JList}
+
 import scala.collection.mutable
 import scala.language.implicitConversions
 import scala.jdk.CollectionConverters.{CollectionHasAsScala, SeqHasAsJava}
@@ -39,8 +41,8 @@ class NCNlpSentenceNote(private val values: Map[String, 
JSerializable]) extends
     lazy val noteType: String = values("noteType").asInstanceOf[String]
     lazy val tokenFrom: Int = values("tokMinIndex").asInstanceOf[Int] // First 
index.
     lazy val tokenTo: Int = values("tokMaxIndex").asInstanceOf[Int] // Last 
index.
-    lazy val tokenIndexes: Seq[Int] = 
values("tokWordIndexes").asInstanceOf[java.util.List[Int]].asScala.toSeq // 
Includes 1st and last indices too.
-    lazy val wordIndexes: Seq[Int] = 
values("wordIndexes").asInstanceOf[java.util.List[Int]].asScala.toSeq // 
Includes 1st and last indices too.
+    lazy val tokenIndexes: Seq[Int] = 
values("tokWordIndexes").asInstanceOf[JList[Int]].asScala.toSeq // Includes 1st 
and last indices too.
+    lazy val wordIndexes: Seq[Int] = 
values("wordIndexes").asInstanceOf[JList[Int]].asScala.toSeq // Includes 1st 
and last indices too.
     lazy val sparsity: Int = values("sparsity").asInstanceOf[Int]
     lazy val isDirect: Boolean = values("direct").asInstanceOf[Boolean]
     lazy val isUser: Boolean = {
@@ -221,7 +223,7 @@ object NCNlpSentenceNote {
         typ: String,
         params: (String, Any)*
     ): NCNlpSentenceNote = {
-        def calc(seq: Seq[Int]): (Int, Int, Int, java.util.List[Int], Int) =
+        def calc(seq: Seq[Int]): (Int, Int, Int, JList[Int], Int) =
             (U.calcSparsity(seq), seq.min, seq.max, seq.asJava, seq.length)
 
         val (sparsity, tokMinIndex, tokMaxIndex, tokWordIndexes, len) = 
calc(wordIndexesOpt.getOrElse(indexes))
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/common/nlp/NCNlpSentenceToken.scala
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/common/nlp/NCNlpSentenceToken.scala
index e54ecd1..4b94b98 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/common/nlp/NCNlpSentenceToken.scala
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/common/nlp/NCNlpSentenceToken.scala
@@ -19,8 +19,9 @@ package org.apache.nlpcraft.common.nlp
 
 import org.apache.nlpcraft.common.nlp.pos._
 
+import java.util.{List => JList}
 import scala.collection.mutable
-import scala.jdk.CollectionConverters.IterableHasAsScala
+import scala.jdk.CollectionConverters.ListHasAsScala
 import scala.language.implicitConversions
 
 /**
@@ -41,7 +42,7 @@ case class NCNlpSentenceToken(
     def origText: String = getNlpValue[String]("origText")
     def words: Int = origText.split(" ").length
     def wordLength: Int = getNlpValue[Int]("wordLength").intValue()
-    def wordIndexes: Seq[Int] = 
getNlpValue[java.util.List[Int]]("wordIndexes").asScala.toSeq
+    def wordIndexes: Seq[Int] = 
getNlpValue[JList[Int]]("wordIndexes").asScala.toSeq
     def pos: String = getNlpValue[String]("pos")
     def posDesc: String = getNlpValue[String]( "posDesc")
     def lemma: String = getNlpValue[String]("lemma")
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/impl/NCTokenImpl.scala 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/impl/NCTokenImpl.scala
index c0bf603..9324278 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/impl/NCTokenImpl.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/impl/NCTokenImpl.scala
@@ -19,6 +19,8 @@ package org.apache.nlpcraft.model.impl
 
 import java.io.{Serializable => JSerializable}
 import java.util.Collections
+import java.util.{List => JList}
+
 import org.apache.nlpcraft.common._
 import org.apache.nlpcraft.common.nlp.NCNlpSentenceToken
 import org.apache.nlpcraft.model._
@@ -64,15 +66,15 @@ private[nlpcraft] class NCTokenImpl(
     override lazy val getModel: NCModelView = mdl
     override lazy val getServerRequestId: String = srvReqId
     override lazy val getId: String = id
-    override lazy val getGroups: java.util.List[String] = grps.asJava
+    override lazy val getGroups: JList[String] = grps.asJava
     override lazy val getParentId: String = parentId
-    override lazy val getAncestors: java.util.List[String] = ancestors.asJava
+    override lazy val getAncestors: JList[String] = ancestors.asJava
     override lazy val getValue: String = value
     override lazy val getStartCharIndex: Int = startCharIndex
     override lazy val getEndCharIndex: Int = endCharIndex
     override lazy val getAliases: java.util.Set[String] = 
meta(TOK_META_ALIASES_KEY, Collections.emptySet())
     override lazy val isAbstract: Boolean = isAbstractProp
-    override def getPartTokens: java.util.List[NCToken] = parts.asJava
+    override def getPartTokens: JList[NCToken] = parts.asJava
 
     def setParts(parts: Seq[NCToken]): Unit = this.parts = parts
 
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/impl/NCTokenLogger.scala 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/impl/NCTokenLogger.scala
index 0d10880..717f0b7 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/impl/NCTokenLogger.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/impl/NCTokenLogger.scala
@@ -19,6 +19,8 @@ package org.apache.nlpcraft.model.impl
 
 import java.text.SimpleDateFormat
 import java.util
+import java.util.{List => JList}
+
 import com.typesafe.scalalogging.LazyLogging
 import org.apache.nlpcraft.common._
 import org.apache.nlpcraft.common.ascii._
@@ -167,7 +169,7 @@ object NCTokenLogger extends LazyLogging {
                 case None => None
             }
             def mkString(name: String): String = getValue(name).toString
-            def mkJListString(name: String): String = 
getValue(name).asInstanceOf[java.util.List[String]].asScala.mkString(",")
+            def mkJListString(name: String): String = 
getValue(name).asInstanceOf[JList[String]].asScala.mkString(",")
             def mkDate(name: String): String = 
format(getValue(name).asInstanceOf[Long])
 
             def getValueOpt(name: String): Option[java.io.Serializable] =
@@ -283,9 +285,9 @@ object NCTokenLogger extends LazyLogging {
                             asScala.map(p => s"${p._1}=${p._2}").mkString(",")
 
                     // Mentions.
-                    val beginOffsets = 
getValue("mentionsBeginOffsets").asInstanceOf[java.util.List[Int]]
-                    val contents = 
getValue("mentionsContents").asInstanceOf[java.util.List[String]]
-                    val types = 
getValue("mentionsTypes").asInstanceOf[java.util.List[String]]
+                    val beginOffsets = 
getValue("mentionsBeginOffsets").asInstanceOf[JList[Int]]
+                    val contents = 
getValue("mentionsContents").asInstanceOf[JList[String]]
+                    val types = 
getValue("mentionsTypes").asInstanceOf[JList[String]]
 
                     require(beginOffsets.size() == contents.size())
                     require(types.size() == contents.size())
@@ -416,7 +418,7 @@ object NCTokenLogger extends LazyLogging {
             }).mkString("|")
 
             def getIndexes(name: String): String = {
-                val idxs: java.util.List[String] = get(name)
+                val idxs: JList[String] = get(name)
 
                 idxs.asScala.mkString(", ")
             }
@@ -465,7 +467,7 @@ object NCTokenLogger extends LazyLogging {
                         case "nlpcraft:date" =>
                             val from = format(get("from"))
                             val to = format(get("to"))
-                            val ps: java.util.List[String] = get("periods")
+                            val ps: JList[String] = get("periods")
 
                             val r = s"$from:$to"
 
@@ -478,10 +480,10 @@ object NCTokenLogger extends LazyLogging {
                             s"type=$t, indexes=[${getIndexes("indexes")}], 
note=$note"
 
                         case "nlpcraft:sort" =>
-                            def x(l: java.util.List[String]): String = 
l.asScala.mkString(", ")
+                            def x(l: JList[String]): String = 
l.asScala.mkString(", ")
 
                             def getList(notesName: String, indexesName: 
String): String = {
-                                val notesOpt: Option[java.util.List[String]] = 
getOpt(notesName)
+                                val notesOpt: Option[JList[String]] = 
getOpt(notesName)
 
                                 notesOpt match {
                                     case Some(notes) =>
@@ -559,9 +561,9 @@ object NCTokenLogger extends LazyLogging {
                             val metaS = meta.asScala.map(p => 
s"${p._1}=${p._2}").mkString(",")
 
                             // Mentions.
-                            val beginOffsets: java.util.List[Int] = 
get("mentionsbeginoffsets")
-                            val contents: java.util.List[String] = 
get("mentionscontents")
-                            val types: java.util.List[String] = 
get("mentionstypes")
+                            val beginOffsets: JList[Int] = 
get("mentionsbeginoffsets")
+                            val contents: JList[String] = 
get("mentionscontents")
+                            val types: JList[String] = get("mentionstypes")
 
                             require(beginOffsets.size() == contents.size())
                             require(types.size() == contents.size())
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/impl/NCTokenPimp.scala 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/impl/NCTokenPimp.scala
index f5b405d..d39436d 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/impl/NCTokenPimp.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/impl/NCTokenPimp.scala
@@ -19,6 +19,8 @@ package org.apache.nlpcraft.model.impl
 
 import org.apache.nlpcraft.model.NCToken
 
+import java.util.{List => JList}
+
 import scala.jdk.CollectionConverters.CollectionHasAsScala
 import scala.language.implicitConversions
 
@@ -43,7 +45,7 @@ class NCTokenPimp(impl: NCToken) {
     def isDirect: Boolean = impl.meta("nlpcraft:nlp:direct")
     def isPermutated: Boolean = !isDirect
     def isBracketed: Boolean = impl.meta("nlpcraft:nlp:bracketed")
-    def wordIndexes: List[Int] = 
impl.meta[java.util.List[Int]]("nlpcraft:nlp:wordindexes").asScala.toList
+    def wordIndexes: List[Int] = 
impl.meta[JList[Int]]("nlpcraft:nlp:wordindexes").asScala.toList
     def origText: String = impl.meta("nlpcraft:nlp:origtext")
     def normText: String = impl.meta("nlpcraft:nlp:normtext")
     def stem: String = impl.meta("nlpcraft:nlp:stem")
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/solver/NCIntentSolver.scala
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/solver/NCIntentSolver.scala
index 17fd13f..1bae8f7 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/solver/NCIntentSolver.scala
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/solver/NCIntentSolver.scala
@@ -28,6 +28,8 @@ import org.apache.nlpcraft.model.intent.NCIdlIntent
 import org.apache.nlpcraft.model.{NCContext, NCIntentMatch, NCIntentSkip, 
NCModel, NCRejection, NCResult, NCToken, NCVariant}
 import org.apache.nlpcraft.probe.mgrs.dialogflow.NCDialogFlowManager
 
+import java.util.{List => JList}
+
 import scala.jdk.CollectionConverters.SeqHasAsJava
 
 /**
@@ -96,12 +98,12 @@ class NCIntentSolver(intents: List[(NCIdlIntent/*Intent*/, 
NCIntentMatch => NCRe
                 
                 val intentMatch: NCIntentMatch = new NCMetadataAdapter with 
NCIntentMatch {
                     override val getContext: NCContext = ctx
-                    override val getIntentTokens: 
java.util.List[java.util.List[NCToken]] = res.groups.map(_.tokens.asJava).asJava
+                    override val getIntentTokens: JList[JList[NCToken]] = 
res.groups.map(_.tokens.asJava).asJava
                     override val getVariant: NCVariant = new 
NCVariantImpl(res.variant.tokens)
                     override val isAmbiguous: Boolean = !res.isExactMatch
                     override val getIntentId: String = res.intentId
-                    override def getTermTokens(idx: Int): 
java.util.List[NCToken] = res.groups(idx).tokens.asJava
-                    override def getTermTokens(termId: String): 
java.util.List[NCToken] = res.groups.find(_.termId === termId).flatMap(grp => 
Some(grp.tokens)).getOrElse(Nil).asJava
+                    override def getTermTokens(idx: Int): JList[NCToken] = 
res.groups(idx).tokens.asJava
+                    override def getTermTokens(termId: String): JList[NCToken] 
= res.groups.find(_.termId === termId).flatMap(grp => 
Some(grp.tokens)).getOrElse(Nil).asJava
                 }
                 
                 if 
(!in.context.getModel.asInstanceOf[NCModel].onMatchedIntent(intentMatch)) {
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/solver/NCIntentSolverEngine.scala
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/solver/NCIntentSolverEngine.scala
index 9946afd..54d6922 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/solver/NCIntentSolverEngine.scala
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/solver/NCIntentSolverEngine.scala
@@ -29,6 +29,8 @@ import org.apache.nlpcraft.model.{NCContext, 
NCDialogFlowItem, NCIntentMatch, NC
 import org.apache.nlpcraft.probe.mgrs.dialogflow.NCDialogFlowManager
 
 import java.util.function.Function
+import java.util.{List => JList}
+
 import scala.collection.mutable
 import scala.jdk.CollectionConverters.{CollectionHasAsScala, MapHasAsScala, 
SeqHasAsJava}
 
@@ -449,11 +451,11 @@ object NCIntentSolverEngine extends LazyLogging with 
NCOpenCensusTrace {
 
             val fqn =
                 s"${if (clsName == null) ctx.getModel.getClass.getName else 
clsName}." +
-                s"$mtdName(java.util.List[NCDialogFlowItem])"
+                s"$mtdName(JList[NCDialogFlowItem])"
 
             val res =
                 try
-                    U.callMethod[java.util.List[NCDialogFlowItem], 
java.lang.Boolean](
+                    U.callMethod[JList[NCDialogFlowItem], java.lang.Boolean](
                         () => if (clsName == null) ctx.getModel else 
U.mkObject(clsName),
                         mtdName,
                         flow.toList.asJava
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/cmd/NCCommandManager.scala
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/cmd/NCCommandManager.scala
index a7480fb..8a88008 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/cmd/NCCommandManager.scala
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/cmd/NCCommandManager.scala
@@ -31,6 +31,8 @@ import org.apache.nlpcraft.probe.mgrs.model.NCModelManager
 import org.apache.nlpcraft.probe.mgrs.nlp.NCProbeEnrichmentManager
 
 import java.util
+import java.util.{List => JList}
+
 import scala.jdk.CollectionConverters.{ListHasAsScala, MapHasAsJava, 
MapHasAsScala, SeqHasAsJava, SetHasAsScala}
 
 /**
@@ -97,7 +99,7 @@ object NCCommandManager extends NCService {
                         NCProbeEnrichmentManager.ask(
                             srvReqId = msg.data[String]("srvReqId"),
                             txt = msg.data[String]("txt"),
-                            nlpSens = 
msg.data[java.util.List[NCNlpSentence]]("nlpSens").asScala,
+                            nlpSens = 
msg.data[JList[NCNlpSentence]]("nlpSens").asScala,
                             usrId = msg.data[Long]("userId"),
                             senMeta = msg.data[java.util.Map[String, 
JSerializable]]("senMeta").asScala,
                             mdlId = msg.data[String]("mdlId"),
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/limit/NCLimitEnricher.scala
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/limit/NCLimitEnricher.scala
index 6b63fbc..9e54a6c 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/limit/NCLimitEnricher.scala
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/limit/NCLimitEnricher.scala
@@ -27,6 +27,8 @@ import org.apache.nlpcraft.probe.mgrs.NCProbeModel
 import org.apache.nlpcraft.probe.mgrs.nlp.NCProbeEnricher
 
 import java.io.Serializable
+import java.util.{List => JList}
+
 import scala.collection.mutable
 import scala.jdk.CollectionConverters.{CollectionHasAsScala, MapHasAsScala, 
SeqHasAsJava}
 
@@ -39,7 +41,7 @@ object NCLimitEnricher extends NCProbeEnricher {
         asc: Option[Boolean],
         matched: Seq[NCNlpSentenceToken],
         refNotes: Set[String],
-        refIndexes: java.util.List[Int]
+        refIndexes: JList[Int]
     )
 
     private final val TOK_ID = "nlpcraft:limit"
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/relation/NCRelationEnricher.scala
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/relation/NCRelationEnricher.scala
index 19aad79..fa564b9 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/relation/NCRelationEnricher.scala
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/relation/NCRelationEnricher.scala
@@ -26,6 +26,8 @@ import org.apache.nlpcraft.common.{NCE, NCService}
 import org.apache.nlpcraft.probe.mgrs.NCProbeModel
 import org.apache.nlpcraft.probe.mgrs.nlp.NCProbeEnricher
 
+import java.util.{List => JList}
+
 import scala.collection.mutable
 import scala.jdk.CollectionConverters.{MapHasAsScala, SeqHasAsJava, 
SetHasAsScala}
 
@@ -39,7 +41,7 @@ object NCRelationEnricher extends NCProbeEnricher {
         matched: Seq[NCNlpSentenceToken],
         matchedHead: NCNlpSentenceToken,
         refNotes: Set[String],
-        refIndexes: java.util.List[Int]
+        refIndexes: JList[Int]
     )
     case class Reference(tokens: Seq[NCNlpSentenceToken], types: Set[String]) {
         require(tokens.nonEmpty)
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/sentence/NCSentenceManager.scala
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/sentence/NCSentenceManager.scala
index 0ef4cff..9120c84 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/sentence/NCSentenceManager.scala
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/sentence/NCSentenceManager.scala
@@ -67,7 +67,7 @@ object NCSentenceManager extends NCService {
         val noteLinks = mutable.ArrayBuffer.empty[NoteLink]
 
         for (n <- notes.filter(n => n.noteType == "nlpcraft:limit" || 
n.noteType == "nlpcraft:references"))
-            noteLinks += NoteLink(n("note").asInstanceOf[String], 
n("indexes").asInstanceOf[JList[Int]].asScala.sorted)
+            noteLinks += NoteLink(n("note").asInstanceOf[String], 
n("indexes").asInstanceOf[JList[Int]].asScala.toSeq.sorted)
 
         for (n <- notes.filter(_.noteType == "nlpcraft:sort")) {
             def add(noteName: String, idxsName: String): Unit = {
@@ -192,7 +192,7 @@ object NCSentenceManager extends NCService {
       */
     private def fixNoteIndexes(note: String, idxsField: String, noteField: 
String, ns: NCNlpSentence): Unit =
         ns.flatMap(_.getNotes(note)).foreach(
-            n => checkRelation(ns, n.data[JList[Int]](idxsField).asScala, 
n.data[String](noteField), n)
+            n => checkRelation(ns, 
n.data[JList[Int]](idxsField).asScala.toSeq, n.data[String](noteField), n)
         )
 
     /**
@@ -211,7 +211,7 @@ object NCSentenceManager extends NCService {
                     require(idxsList.size() == notesTypes.size())
 
                     idxsList.asScala.zip(notesTypes.asScala).foreach {
-                        case (idxs, notesType) => checkRelation(ns, 
idxs.asScala, notesType, rel)
+                        case (idxs, notesType) => checkRelation(ns, 
idxs.asScala.toSeq, notesType, rel)
                     }
                 case None => // No-op.
             }
@@ -464,7 +464,7 @@ object NCSentenceManager extends NCService {
             tok.getNoteOpt(noteType, idxsField) match {
                 case Some(n) =>
                     val idxs: Seq[Seq[Int]] =
-                        
n.data[JList[JList[Int]]](idxsField).asScala.map(_.asScala)
+                        
n.data[JList[JList[Int]]](idxsField).asScala.map(_.asScala.toSeq).toSeq
                     var fixed = idxs
 
                     history.foreach {
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/nlp/enrichers/date/NCDateEnricher.scala
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/nlp/enrichers/date/NCDateEnricher.scala
index e4c7908..a4e8e11 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/nlp/enrichers/date/NCDateEnricher.scala
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/nlp/enrichers/date/NCDateEnricher.scala
@@ -28,6 +28,8 @@ import 
org.apache.nlpcraft.server.nlp.enrichers.date.NCDateFormatType._
 
 import java.util
 import java.util.{Calendar => C}
+import java.util.{List => JList}
+
 import scala.collection.immutable.Iterable
 import scala.collection.mutable
 import scala.collection.mutable.{LinkedHashMap => LHM}
@@ -626,7 +628,7 @@ object NCDateEnricher extends NCServerEnricher {
 
             // Groups ordered to keep node with maximum information (max 
periods count in date).
             val hs: Iterable[Seq[Note]] =
-                grouped.map(_._2.sortBy(h => 
-h("periods").asInstanceOf[java.util.List[String]].asScala.length))
+                grouped.map(_._2.sortBy(h => 
-h("periods").asInstanceOf[JList[String]].asScala.length))
 
             // First holder will be kept in group, others (tail) should be 
deleted.
             hs.flatMap(_.tail)
@@ -661,7 +663,7 @@ object NCDateEnricher extends NCServerEnricher {
     private def mkDateRange(n1: Note, n2: Note): NCDateRange = 
NCDateRange(n1("from").asInstanceOf[Long], n2("to").asInstanceOf[Long])
     private def mkDateRange(n: Note): NCDateRange = mkDateRange(n, n)
     private def getField(d: Long, field: Int): Int = mkCalendar(d).get(field)
-    private def equalHolder(h: Note, ps: String*): Boolean = 
h("periods").asInstanceOf[java.util.List[String]].asScala.sorted == ps.sorted
+    private def equalHolder(h: Note, ps: String*): Boolean = 
h("periods").asInstanceOf[JList[String]].asScala.sorted == ps.sorted
     private def equalHolders(hs: Seq[Note], ps: String*): Boolean = 
hs.forall(equalHolder(_, ps: _*))
     private def getPrevious[T](s: T, seq: Seq[T]): T = seq(seq.indexOf(s) - 1)
     private def nearRanges(ns: Seq[Note]): Boolean =
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/nlp/enrichers/date/NCDateRange.scala
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/nlp/enrichers/date/NCDateRange.scala
index 9c80507..31cf8ff 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/nlp/enrichers/date/NCDateRange.scala
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/nlp/enrichers/date/NCDateRange.scala
@@ -19,6 +19,7 @@ package org.apache.nlpcraft.server.nlp.enrichers.date
 
 import java.text.SimpleDateFormat
 import java.time._
+import java.util.{List => JList}
 
 object NCDateRange {
     private final val UTC = ZoneId.of("UTC")
@@ -36,7 +37,7 @@ object NCDateRange {
       * @param periods
       * @return
       */
-    def apply(from: Long, to: Long, text: String, periods: 
java.util.List[String]) =
+    def apply(from: Long, to: Long, text: String, periods: JList[String]) =
         new NCDateRange(from, to, text, periods)
     
     /**
@@ -63,7 +64,7 @@ import 
org.apache.nlpcraft.server.nlp.enrichers.date.NCDateRange._
 /**
   * Date range data holder.
   */
-class NCDateRange(val from: Long, val to: Long, val text: String, val periods: 
java.util.List[String]) {
+class NCDateRange(val from: Long, val to: Long, val text: String, val periods: 
JList[String]) {
     private val hash = 31 * from.hashCode() + to.hashCode()
     
     /**
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/sugsyn/NCSuggestSynonymResult.scala
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/sugsyn/NCSuggestSynonymResult.scala
index b504d1a..1efefd6 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/sugsyn/NCSuggestSynonymResult.scala
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/sugsyn/NCSuggestSynonymResult.scala
@@ -17,6 +17,8 @@
 
 package org.apache.nlpcraft.server.sugsyn
 
+import java.util.{List => JList}
+
 /**
  * Result of the model synonym suggestion tool.
  *
@@ -34,6 +36,6 @@ case class NCSuggestSynonymResult(
     durationMs: Long,
     timestamp: Long,
     error: String,
-    suggestions: java.util.List[AnyRef],
-    warnings: java.util.List[String]
+    suggestions: JList[AnyRef],
+    warnings: JList[String]
 )
diff --git 
a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/dialog/NCDialogSpec.scala 
b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/dialog/NCDialogSpec.scala
index 2da6b53..9eee168 100644
--- 
a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/dialog/NCDialogSpec.scala
+++ 
b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/dialog/NCDialogSpec.scala
@@ -23,16 +23,18 @@ import org.junit.jupiter.api.Assertions.{assertEquals, 
assertTrue}
 import org.junit.jupiter.api.Test
 
 import java.util
+import java.util.{List => JList}
+
 import scala.jdk.CollectionConverters.CollectionHasAsScala
 
 /**
   * Test model.
   */
 class NCDialogSpecModelFlow {
-    def trueAlways(flow: java.util.List[NCDialogFlowItem]): Boolean = true
-    def falseAlways(flow: java.util.List[NCDialogFlowItem]): Boolean = false
-    def trueAfterOnA7(flow: java.util.List[NCDialogFlowItem]): Boolean = 
flow.asScala.exists(_.getIntentId == "onA7")
-    def trueAfterOnA7AndA8(flow: java.util.List[NCDialogFlowItem]): Boolean = {
+    def trueAlways(flow: JList[NCDialogFlowItem]): Boolean = true
+    def falseAlways(flow: JList[NCDialogFlowItem]): Boolean = false
+    def trueAfterOnA7(flow: JList[NCDialogFlowItem]): Boolean = 
flow.asScala.exists(_.getIntentId == "onA7")
+    def trueAfterOnA7AndA8(flow: JList[NCDialogFlowItem]): Boolean = {
         val seq = flow.asScala
         seq.exists(_.getIntentId == "onA7") && seq.exists(_.getIntentId == 
"onA8")
     }
@@ -72,12 +74,12 @@ class NCDialogSpecModel extends NCModel {
     @NCIntent("intent=onA9 
flow=/org.apache.nlpcraft.model.dialog.NCDialogSpecModelFlow#trueAfterOnA7AndA8/
 term~{tok_id() == 'a9'}")
     def onA9(): NCResult = NCResult.text("ok")
 
-    def trueAlwaysInternal(flow: java.util.List[NCDialogFlowItem]): Boolean = 
true
+    def trueAlwaysInternal(flow: JList[NCDialogFlowItem]): Boolean = true
 
     @NCIntent("intent=onA10 flow=/#trueAlwaysInternal/ term~{tok_id() == 
'a10'}")
     def onA10(): NCResult = NCResult.text("ok")
 
-    def falseAlwaysInternal(flow: java.util.List[NCDialogFlowItem]): Boolean = 
false
+    def falseAlwaysInternal(flow: JList[NCDialogFlowItem]): Boolean = false
 
     @NCIntent("intent=onA11 flow=/#falseAlwaysInternal/ term~{tok_id() == 
'a11'}")
     def onA11(): NCResult = NCResult.text("ok")
diff --git 
a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/dialog/NCDialogSpec2.scala 
b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/dialog/NCDialogSpec2.scala
index bc0cc1a..79384ae 100644
--- 
a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/dialog/NCDialogSpec2.scala
+++ 
b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/dialog/NCDialogSpec2.scala
@@ -22,6 +22,7 @@ import org.apache.nlpcraft.{NCTestContext, NCTestElement, 
NCTestEnvironment}
 import org.junit.jupiter.api.Test
 
 import java.util
+import java.util.{List => JList}
 
 object NCDialogSpecModelFlow2  {
     var error = false
@@ -33,11 +34,11 @@ import NCDialogSpecModelFlow2._
   * Test model.
   */
 class NCDialogSpecModelFlow2  {
-    def invalidDef1(flow: java.util.List[NCDialogFlowItem]): String = "string"
+    def invalidDef1(flow: JList[NCDialogFlowItem]): String = "string"
     def invalidDef2(): Boolean = true
-    def invalidDef3(flow: java.util.List[NCDialogFlowItem]): Boolean = throw 
new IllegalStateException()
-    def invalidDef4(flow: java.util.List[NCDialogFlowItem]): java.lang.Boolean 
= null
-    def validDef(flow: java.util.List[NCDialogFlowItem]): Boolean = {
+    def invalidDef3(flow: JList[NCDialogFlowItem]): Boolean = throw new 
IllegalStateException()
+    def invalidDef4(flow: JList[NCDialogFlowItem]): java.lang.Boolean = null
+    def validDef(flow: JList[NCDialogFlowItem]): Boolean = {
         if (error)
             throw new IllegalStateException()
 
diff --git 
a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/NCEnrichersTestBeans.scala
 
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/NCEnrichersTestBeans.scala
index 8f60144..fa54b2d 100644
--- 
a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/NCEnrichersTestBeans.scala
+++ 
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/NCEnrichersTestBeans.scala
@@ -20,6 +20,8 @@ package org.apache.nlpcraft.probe.mgrs.nlp.enrichers
 import org.apache.nlpcraft.model.NCToken
 
 import scala.util.Using
+
+import java.util.{List => JList}
 import java.io.{ByteArrayInputStream, ByteArrayOutputStream, 
ObjectInputStream, ObjectOutputStream}
 import java.nio.charset.StandardCharsets.UTF_8
 import java.util
@@ -316,10 +318,10 @@ object NCTestToken {
             case "nlpcraft:continent" => NCTestContinentToken(txt, continent = 
t.meta("nlpcraft:continent:continent"))
             case "nlpcraft:metro" => NCTestMetroToken(txt, metro = 
t.meta("nlpcraft:metro:metro"))
             case "nlpcraft:sort" =>
-                val subjNotes: Optional[java.util.List[String]] = 
t.metaOpt("nlpcraft:sort:subjnotes")
-                val subjIndexes: Optional[java.util.List[Int]] = 
t.metaOpt("nlpcraft:sort:subjindexes")
-                val byNotes: Optional[java.util.List[String]] = 
t.metaOpt("nlpcraft:sort:bynotes")
-                val byIndexes: Optional[java.util.List[Int]] = 
t.metaOpt("nlpcraft:sort:byindexes")
+                val subjNotes: Optional[JList[String]] = 
t.metaOpt("nlpcraft:sort:subjnotes")
+                val subjIndexes: Optional[JList[Int]] = 
t.metaOpt("nlpcraft:sort:subjindexes")
+                val byNotes: Optional[JList[String]] = 
t.metaOpt("nlpcraft:sort:bynotes")
+                val byIndexes: Optional[JList[Int]] = 
t.metaOpt("nlpcraft:sort:byindexes")
                 val asc: Optional[Boolean] = t.metaOpt("nlpcraft:sort:asc")
 
                 def get[T](opt: Optional[util.List[T]]) =
@@ -330,7 +332,7 @@ object NCTestToken {
 
                 NCTestSortToken(txt, get(subjNotes), get(subjIndexes), 
get(byNotes), get(byIndexes), asc.asScala)
             case "nlpcraft:relation" =>
-                val indexes: java.util.List[Int] = 
t.meta("nlpcraft:relation:indexes")
+                val indexes: JList[Int] = t.meta("nlpcraft:relation:indexes")
 
                 NCTestRelationToken(
                     txt,
@@ -340,7 +342,7 @@ object NCTestToken {
                 )
 
             case "nlpcraft:limit" =>
-                val indexes: java.util.List[Int] = 
t.meta("nlpcraft:limit:indexes")
+                val indexes: JList[Int] = t.meta("nlpcraft:limit:indexes")
                 val asc: Optional[Boolean] = t.metaOpt("nlpcraft:limit:asc")
 
                 NCTestLimitToken(
diff --git 
a/nlpcraft/src/test/scala/org/apache/nlpcraft/server/rest/NCRestModelSpec.scala 
b/nlpcraft/src/test/scala/org/apache/nlpcraft/server/rest/NCRestModelSpec.scala
index fc1e22c..1345fc5 100644
--- 
a/nlpcraft/src/test/scala/org/apache/nlpcraft/server/rest/NCRestModelSpec.scala
+++ 
b/nlpcraft/src/test/scala/org/apache/nlpcraft/server/rest/NCRestModelSpec.scala
@@ -21,6 +21,8 @@ import org.apache.nlpcraft.NCTestEnvironment
 import org.junit.jupiter.api.Assertions._
 import org.junit.jupiter.api.Test
 
+import java.util.{List => JList}
+
 import scala.jdk.CollectionConverters.ListHasAsScala
 
 /**
@@ -30,13 +32,13 @@ import scala.jdk.CollectionConverters.ListHasAsScala
 class NCRestModelSpec extends NCRestSpec {
     @Test
     def test(): Unit = {
-        def extract(data: java.util.List[java.util.Map[String, Object]]): 
Seq[Double] =
+        def extract(data: JList[java.util.Map[String, Object]]): Seq[Double] =
             
data.asScala.map(_.get("score").asInstanceOf[Number].doubleValue()).toSeq
 
         // Note that checked values are valid for current configuration of 
`RestTestModel` model.
         post("model/sugsyn", "mdlId" -> "rest.test.model")(
             ("$.status", (status: String) => assertEquals("API_OK", status)),
-            ("$.result.suggestions[:1].a.*", (data: 
java.util.List[java.util.Map[String, Object]]) => {
+            ("$.result.suggestions[:1].a.*", (data: 
JList[java.util.Map[String, Object]]) => {
                 val scores = extract(data)
 
                 assertTrue(scores.nonEmpty)
@@ -47,7 +49,7 @@ class NCRestModelSpec extends NCRestSpec {
         )
         post("model/sugsyn", "mdlId" -> "rest.test.model", "minScore" -> 0.5)(
             ("$.status", (status: String) => assertEquals("API_OK", status)),
-            ("$.result.suggestions[:1].a.*", (data: 
java.util.List[java.util.Map[String, Object]]) => {
+            ("$.result.suggestions[:1].a.*", (data: 
JList[java.util.Map[String, Object]]) => {
                 val scores = extract(data)
 
                 assertTrue(scores.nonEmpty)
diff --git 
a/nlpcraft/src/test/scala/org/apache/nlpcraft/server/rest/NCRestSpec.scala 
b/nlpcraft/src/test/scala/org/apache/nlpcraft/server/rest/NCRestSpec.scala
index 1150411..948e5ee 100644
--- a/nlpcraft/src/test/scala/org/apache/nlpcraft/server/rest/NCRestSpec.scala
+++ b/nlpcraft/src/test/scala/org/apache/nlpcraft/server/rest/NCRestSpec.scala
@@ -32,7 +32,9 @@ import org.junit.jupiter.api.Assertions._
 import org.junit.jupiter.api.{AfterEach, BeforeEach}
 
 import java.util
+import java.util.{List => JList}
 import java.util.UUID
+
 import scala.jdk.CollectionConverters.{ListHasAsScala, MapHasAsJava, 
MapHasAsScala, SeqHasAsJava}
 
 object NCRestSpec {
@@ -127,8 +129,8 @@ import org.apache.nlpcraft.server.rest.NCRestSpec._
 
 class NCRestSpec extends NCTestContext {
     type ResponseContent = java.util.Map[String, Object]
-    type ResponseList = java.util.List[ResponseContent]
-    type JList[T] = java.util.List[T]
+    type ResponseList = JList[ResponseContent]
+    type JList[T] = JList[T]
 
     protected var tkn: String = _
     /**

Reply via email to