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

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


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

commit fae2d4d718ffce11917d1ff94d2114b0832fdce0
Author: Sergey Kamov <[email protected]>
AuthorDate: Sat Aug 28 11:20:52 2021 +0300

    WIP.
---
 .../model/NCEnricherNestedModelSpec6.scala         | 32 ++++++++++------------
 1 file changed, 15 insertions(+), 17 deletions(-)

diff --git 
a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/NCEnricherNestedModelSpec6.scala
 
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/NCEnricherNestedModelSpec6.scala
index ab2b035..b4a5d1c 100644
--- 
a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/NCEnricherNestedModelSpec6.scala
+++ 
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/NCEnricherNestedModelSpec6.scala
@@ -17,7 +17,7 @@
 
 package org.apache.nlpcraft.probe.mgrs.nlp.enrichers.model
 
-import org.apache.nlpcraft.model.{NCElement, NCIntent, NCModelAdapter, 
NCResult}
+import org.apache.nlpcraft.model.{NCElement, NCIntent, NCIntentMatch, 
NCModelAdapter, NCResult}
 import org.apache.nlpcraft.{NCTestContext, NCTestElement, NCTestEnvironment}
 import org.junit.jupiter.api.Test
 
@@ -65,7 +65,7 @@ class NCNestedTestModel6 extends 
NCModelAdapter("nlpcraft.nested5.test.mdl", "Te
             )
         )
     @NCIntent("intent=compose1 term(x)={tok_id() == 'compose1'}")
-    private def onCompose1(): NCResult = NCResult.text("OK")
+    private def onCompose1(ctx: NCIntentMatch): NCResult = NCResult.text("OK")
 
     @NCIntent("intent=compose2 term(x)={tok_id() == 'compose2'}")
     private def onCompose2(): NCResult = NCResult.text("OK")
@@ -78,24 +78,22 @@ class NCNestedTestModel6 extends 
NCModelAdapter("nlpcraft.nested5.test.mdl", "Te
   */
 @NCTestEnvironment(model = classOf[NCNestedTestModel6], startClient = true)
 class NCEnricherNestedModelSpec6 extends NCTestContext {
-    @Test
-    def testCompose1(): Unit = {
-        checkIntent("a1 t1 t2 t3 b1", "compose1")
-        checkIntent("a1 t1 t2 b1", "compose1")
-        checkIntent("a1 t1 b1", "compose1")
+    private def test(i: Int): Unit = {
+        // 1, 2 and 3 any words should be suitable.
+        checkIntent(s"a$i t1 t2 t3 b$i", s"compose$i")
+        checkIntent(s"a$i t1 t2 b$i", s"compose$i")
+        checkIntent(s"a$i t1 b$i", s"compose$i")
+
+        // Too long.
+        checkFail(s"a$i t1 t2 t3 t4 b$i")
     }
 
     @Test
-    def testCompose2(): Unit = {
-        checkIntent("a2 t1 t2 t3 b2", "compose2")
-        checkIntent("a2 t1 t2 b2", "compose2")
-        checkIntent("a2 t1 b2", "compose2")
-    }
+    def testCompose1(): Unit = test(1)
 
     @Test
-    def testCompose3(): Unit = {
-        checkIntent("a3 t1 t2 t3 b3", "compose3")
-        checkIntent("a3 t1 t2 b3", "compose3")
-        checkIntent("a3 t1 b3", "compose3")
-    }
+    def testCompose2(): Unit = test(2)
+
+    @Test
+    def testCompose3(): Unit = test(3)
 }

Reply via email to