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

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


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

commit b1d1fb0ceb5668acfdbf595f75d7f5b2795fc9ce
Author: Sergey Kamov <[email protected]>
AuthorDate: Thu Feb 17 23:55:52 2022 +0300

    WIP.
---
 .../org/apache/nlpcraft/internal/impl/NCModelClientImpl.scala     | 6 +++---
 .../org/apache/nlpcraft/internal/impl/NCModelClientImplSpec.scala | 8 ++++----
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/impl/NCModelClientImpl.scala
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/impl/NCModelClientImpl.scala
index 5fc70bb..308ec71 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/impl/NCModelClientImpl.scala
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/internal/impl/NCModelClientImpl.scala
@@ -24,7 +24,7 @@ import org.apache.nlpcraft.internal.util.*
 
 import java.util.concurrent.*
 import java.util.concurrent.atomic.AtomicReference
-import java.util.{Objects, List as JList, Map as JMap}
+import java.util.{Objects, List as JList, Map as JMap, Collections as JColls}
 import scala.collection.mutable
 import scala.concurrent.ExecutionContext
 import scala.jdk.CollectionConverters.*
@@ -58,10 +58,10 @@ class NCModelClientImpl(mdl: NCModel) extends LazyLogging:
 
         add(pipeline.getTokenEnrichers)
         add(pipeline.getTokenValidators)
-        add(pipeline.getEntityParsers)
+        add(pipeline.getEntityEnrichers)
         add(pipeline.getEntityParsers)
         add(pipeline.getEntityValidators)
-        add(pipeline.getTokenValidators)
+        if pipeline.getVariantFilter.isPresent then 
add(JColls.singletonList(pipeline.getVariantFilter.get()))
 
         plSrvs = buf.toSeq
         processServices(_.onStart(cfg), "started")
diff --git 
a/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/impl/NCModelClientImplSpec.scala
 
b/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/impl/NCModelClientImplSpec.scala
index 36fc302..9d09503 100644
--- 
a/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/impl/NCModelClientImplSpec.scala
+++ 
b/nlpcraft/src/test/scala/org/apache/nlpcraft/internal/impl/NCModelClientImplSpec.scala
@@ -35,8 +35,9 @@ class NCModelClientImplSpec:
     def test(): Unit =
         val mdl =
             new NCTestModelAdapter():
-                @NCIntent("intent=ls term(act)={has(ent_groups, 'act')} 
term(loc)={# == 'ls:loc'}*")
-                def onMatch(@NCIntentTerm("act") act: NCEntity, 
@NCIntentTerm("loc") locs: Seq[NCEntity]): NCResult =
+                //@NCIntent("intent=ls term(act)={has(ent_groups, 'act')} 
term(loc)={# == 'ls:loc'}*")
+                @NCIntent("intent=ls term(act)={# == 'ls:on'} term(loc)={# == 
'ls:loc'}*")
+                def onMatch(@NCIntentTerm("act") act: NCEntity, 
@NCIntentTerm("loc") locs: List[NCEntity]): NCResult =
                     val ncRes = new NCResult()
                     ncRes.setType(NCResultType.ASK_RESULT)
                     ncRes.setBody(if locs.isEmpty then "entire house" else 
locs.map(_.mkText()).mkString(","))
@@ -53,9 +54,8 @@ class NCModelClientImplSpec:
 
         val client = new NCModelClientImpl(mdl)
 
-        val res = client.askSync("What are the least performing categories for 
the last quarter?", null, "userId")
+        val res = client.askSync("Lights on at second floor kitchen", null, 
"userId")
 
-        println(res)
         println(res.getIntentId)
         println(res.getBody)
 

Reply via email to