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

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


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

commit 7c7c3794610c3ffb42731ec2690b552dd5975294
Author: Sergey Kamov <[email protected]>
AuthorDate: Wed Jul 28 13:06:09 2021 +0300

    WIP.
---
 .../apache/nlpcraft/model/intent/solver/NCIntentSolver.scala  | 11 ++++++++---
 .../nlpcraft/models/stm/NCStmIndexesTestModelSpec.scala       |  4 ++--
 2 files changed, 10 insertions(+), 5 deletions(-)

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 69935d8..fa77941 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
@@ -215,7 +215,12 @@ class NCIntentSolver(intents: List[(NCIdlIntent/*Intent*/, 
NCIntentMatch => NCRe
 
             if (actualNonConvRefs.nonEmpty) {
                 if (!validate(actualNonConvRefs))
-                    throw new NCE(s"Actual valid variant references are not 
found for recalculation [id=$refId]")
+                    throw new NCE(
+                        s"Actual valid variant references are not found for 
recalculation [" +
+                            s"id=$refId, " +
+                            s"actualNonConvRefs=${actualNonConvRefs.map(p => 
s"${p.getOriginalText}(${p.getId}-${p.getIndex})").mkString(",")}" +
+                            s"]"
+                    )
 
                 actualNonConvRefs
             }
@@ -259,7 +264,7 @@ class NCIntentSolver(intents: List[(NCIdlIntent/*Intent*/, 
NCIntentMatch => NCRe
                                 groupBy { case (refId, _) => refId }.
                                 map { case (refId, data) =>  refId -> 
data.map(_._2) }.
                                 foreach { case (refId, refIdxs) =>
-                                    getForRecalc(refId, refIdxs, _.size != 
refIdxs.size).
+                                    getForRecalc(refId, refIdxs, _.size == 
refIdxs.size).
                                         foreach(t => data += t.getId -> 
t.getIndex)
                                 }
 
@@ -302,7 +307,7 @@ class NCIntentSolver(intents: List[(NCIdlIntent/*Intent*/, 
NCIntentMatch => NCRe
                     val refsIds = refs.map(_.getId).distinct
 
                     if (refsIds.size != 1)
-                        throw new NCE(s"Valid variant references are not found 
[id=$refId, count=${refIdxs.size}]")
+                        throw new NCE(s"Valid variant references are not found 
[id=$refId]")
 
                     convTok.getMetadata.put(s"nlpcraft:relation:note", 
refsIds.head)
                     convTok.getMetadata.put(s"nlpcraft:relation:indexes", 
refs.map(_.getIndex).asJava)
diff --git 
a/nlpcraft/src/test/scala/org/apache/nlpcraft/models/stm/NCStmIndexesTestModelSpec.scala
 
b/nlpcraft/src/test/scala/org/apache/nlpcraft/models/stm/NCStmIndexesTestModelSpec.scala
index e28d4e5..173f139 100644
--- 
a/nlpcraft/src/test/scala/org/apache/nlpcraft/models/stm/NCStmIndexesTestModelSpec.scala
+++ 
b/nlpcraft/src/test/scala/org/apache/nlpcraft/models/stm/NCStmIndexesTestModelSpec.scala
@@ -98,9 +98,9 @@ class NCStmIndexesTestModelSpec extends NCTestContext {
             NCStmIndexesTestModelData(bynotes = Seq("A"), byindexes = Seq(3))
         )
         checkResult(
-            "b b",
+            "test b b",
             extract,
-            NCStmIndexesTestModelData(bynotes = Seq("B"), byindexes = Seq(0))
+            NCStmIndexesTestModelData(bynotes = Seq("B"), byindexes = Seq(1))
         )
     }
 }
\ No newline at end of file

Reply via email to