You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nlpcraft.apache.org by ar...@apache.org on 2020/12/31 20:25:09 UTC

[incubator-nlpcraft] branch master updated: Added warning for intersecting intents.

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

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


The following commit(s) were added to refs/heads/master by this push:
     new d0daf6f  Added warning for intersecting intents.
d0daf6f is described below

commit d0daf6f483f04999dff126db280eab4f407bcef0
Author: Aaron Radzinski <ar...@datalingvo.com>
AuthorDate: Thu Dec 31 12:24:55 2020 -0800

    Added warning for intersecting intents.
---
 .../apache/nlpcraft/model/intent/impl/NCIntentSolverEngine.scala | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/NCIntentSolverEngine.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/NCIntentSolverEngine.scala
index 6e61415..c291a3f 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/NCIntentSolverEngine.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/NCIntentSolverEngine.scala
@@ -250,6 +250,13 @@ object NCIntentSolverEngine extends LazyLogging with NCOpenCensusTrace {
                     case x1 ⇒
                         require(x1 == 0)
 
+                        logger.warn(s"|>")
+                        logger.warn(s"|> Two matching intents ('${m1.intentMatch.intent.id}' and '${m2.intentMatch.intent.id}') have the same match weights.")
+                        logger.warn(s"|> Such intents will be further sorted based on their variants weights.")
+                        logger.warn(s"|> It is recommended that intents should not be so similar as to produce matches with identical weight.")
+                        logger.warn(s"|> Such situation is indicative of intersecting intents - modify intent definitions to avoid it.")
+                        logger.warn(s"|>")
+
                         // 2. First with maximum variant.
                         m1.variant.compareTo(m2.variant) match {
                             case x2 if x2 < 0 ⇒ false
@@ -270,7 +277,7 @@ object NCIntentSolverEngine extends LazyLogging with NCOpenCensusTrace {
                                 }
 
                                 // Order doesn't make sense here.
-                                // It is just to provide deterministic result for the matches with the same weight.
+                                // It is just to provide deterministic result for the matches with the same weights.
                                 calcHash(m1) > calcHash(m2)
                         }
                 }