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

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


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

commit f7613179d907c0fdfec69b8076bf51e508268cda
Author: Sergey Kamov <[email protected]>
AuthorDate: Wed Sep 15 19:09:17 2021 +0300

    WIP.
---
 .../model/stop/NCStopWordsInsideSpec.scala         | 25 +++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git 
a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/stop/NCStopWordsInsideSpec.scala
 
b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/stop/NCStopWordsInsideSpec.scala
index cac6983..35bc242 100644
--- 
a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/stop/NCStopWordsInsideSpec.scala
+++ 
b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/stop/NCStopWordsInsideSpec.scala
@@ -17,11 +17,12 @@
 
 package org.apache.nlpcraft.model.stop
 
-import org.apache.nlpcraft.model.{NCElement, NCIntent, NCModelAdapter, 
NCResult}
+import org.apache.nlpcraft.model.{NCContext, NCElement, NCIntent, 
NCIntentMatch, NCIntentTerm, NCModelAdapter, NCResult, NCToken}
 import org.apache.nlpcraft.{NCTestContext, NCTestElement, NCTestEnvironment}
 import org.junit.jupiter.api.Test
 
 import java.util
+import scala.jdk.CollectionConverters.CollectionHasAsScala
 import scala.language.implicitConversions
 
 /**
@@ -31,7 +32,15 @@ class NCStopWordsInsideModel extends 
NCModelAdapter("nlpcraft.test", "Test Model
     override def getElements: util.Set[NCElement] = 
Set(NCTestElement("complex", "a b"))
 
     @NCIntent("intent=i term={# == 'complex'}")
-    def onI(): NCResult = NCResult.text("OK")
+    def onI(
+        ctx: NCIntentMatch
+    ): NCResult = {
+        require(ctx.getContext.getVariants.size() == 1)
+        require(ctx.getContext.getVariants.asScala.head.asScala.size == 1)
+        
require(ctx.getContext.getVariants.asScala.head.asScala.head.getNormalizedText 
== ctx.getContext.getRequest.getNormalizedText)
+
+        NCResult.text("OK")
+    }
 }
 
 /**
@@ -56,5 +65,15 @@ class NCStopWordsInsideSparseModel extends 
NCStopWordsInsideModel {
 }
 
 @NCTestEnvironment(model = classOf[NCStopWordsInsideSparseModel], startClient 
= true)
-class NCStopWordsInsideSparseSpec extends NCStopWordsInsideSpec
+class NCStopWordsInsideSparseSpec extends NCStopWordsInsideSpec {
+    @Test
+    def test2(): Unit = {
+        checkIntent("a b", "i")
+        checkIntent("a the b", "i")
+        checkIntent("a , b", "i")
+        checkIntent("a, b", "i")
+        checkIntent("a, the b", "i")
+        checkIntent("a, the, b", "i")
+    }
+}
 

Reply via email to