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

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


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

commit 040c6914da8b7a81094161905c4e194881d49f54
Author: Sergey Kamov <[email protected]>
AuthorDate: Thu Dec 30 00:14:50 2021 +0300

    WIP.
---
 .../semantic/NCSemanticEntityParserSpec.scala      | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git 
a/nlpcraft/src/test/java/org/apache/nlpcraft/nlp/entity/parser/semantic/NCSemanticEntityParserSpec.scala
 
b/nlpcraft/src/test/java/org/apache/nlpcraft/nlp/entity/parser/semantic/NCSemanticEntityParserSpec.scala
index e7d0381..b567cd2 100644
--- 
a/nlpcraft/src/test/java/org/apache/nlpcraft/nlp/entity/parser/semantic/NCSemanticEntityParserSpec.scala
+++ 
b/nlpcraft/src/test/java/org/apache/nlpcraft/nlp/entity/parser/semantic/NCSemanticEntityParserSpec.scala
@@ -32,6 +32,21 @@ import scala.concurrent.ExecutionContext
 import scala.jdk.CollectionConverters.*
 import scala.jdk.OptionConverters.RichOptional
 
+case class Element(
+    id: String,
+    synonyms: Seq[String] = Seq.empty,
+    values: Map[String, Seq[String]] = Map.empty,
+    groups: Seq[String] = Seq.empty
+) extends NCSemanticElement {
+    override def getId: String = id
+    override def getGroups: util.List[String] = groups.asJava
+    override def getValues: util.List[NCSemanticElementValue] = values.map { 
case (k, v) =>
+        new NCSemanticElementValue:
+            override def getName: String = k
+            override def getSynonyms: util.List[String] = v.asJava
+    }.toSeq.asJava
+    override def getSynonyms: util.List[String] = synonyms.asJava
+}
 /**
   *
   */
@@ -44,12 +59,7 @@ class NCSemanticEntityParserSpec:
             NCTestUtils.makeAndStart(
                 new NCSemanticEntityParser(
                     new NCENSemanticTextStemmer,
-                    Seq(
-                        new NCSemanticElement {
-                            override def getId: String = "testId"
-                            override def getSynonyms: util.List[String] = 
Seq("test").asJava
-                        }
-                    ).asJava
+                    Seq(Element("testId", synonyms = Seq("test"))).asJava
                 )
             )
 

Reply via email to