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 08:17:18 UTC
[incubator-nlpcraft] 02/02: Fix for dialog flow tests.
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
commit 7456d584d0039627c2c9e5eabba92ef4b353da7d
Author: Aaron Radzinski <ar...@datalingvo.com>
AuthorDate: Thu Dec 31 00:17:02 2020 -0800
Fix for dialog flow tests.
---
.../model/intent/impl/NCIntentSolverEngine.scala | 4 +-
.../nlpcraft/model/dialog/NCDialogSpec.scala | 51 +++++++++++-----------
2 files changed, 28 insertions(+), 27 deletions(-)
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 a1c832b..0da10af 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
@@ -387,8 +387,8 @@ object NCIntentSolverEngine extends LazyLogging with NCOpenCensusTrace {
val flowRegex = intent.flowRegex
// Check dialog flow first.
- if (intent.flowRegex.isDefined && !flowRegex.get.matcher(hist.mkString(" ")).matches()) {
- logger.info(s"Intent '$intentId' didn't match because of dialog flow $varStr:")
+ if (intent.flowRegex.isDefined && !flowRegex.get.matcher(hist.mkString(" ")).find(0)) {
+ logger.info(s"Intent '$intentId' ${r("did not")} match because of dialog flow $varStr:")
logger.info(s" |-- ${c("History:")} ${hist.mkString(" ")}")
logger.info(s" +-- ${c("Regex:")} ${flowRegex.get.toString}")
diff --git a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/dialog/NCDialogSpec.scala b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/dialog/NCDialogSpec.scala
index 2ed7e21..3d98c1b 100644
--- a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/dialog/NCDialogSpec.scala
+++ b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/dialog/NCDialogSpec.scala
@@ -82,39 +82,40 @@ class NCDialogSpec extends NCTestContext {
cli.clearConversation()
cli.clearDialog()
-
- go()
}
@Test
@throws[Exception]
- private[dialog] def test1(): Unit = f(
- "a2" → null,
- "a1" → "onA1",
- "a2" → "onA2",
- "a1" → "onA1",
- "a1" → "onA1",
- "a2" -> null
- )
+ private[dialog] def test1(): Unit =
+ f(
+ "a2" → null,
+ "a1" → "onA1",
+ "a2" → "onA2",
+ "a1" → "onA1",
+ "a1" → "onA1",
+ "a2" -> null
+ )
@Test
@throws[Exception]
- private[dialog] def test2(): Unit = f(
- "a3" → null,
- "a1" → "onA1",
- "a3" → "onA3",
- "a1" → "onA1",
- "a1" → "onA1",
- "a3" -> null
- )
+ private[dialog] def test2(): Unit =
+ f(
+ "a3" → null,
+ "a1" → "onA1",
+ "a3" → "onA3",
+ "a1" → "onA1",
+ "a1" → "onA1",
+ "a3" → "onA3"
+ )
@Test
@throws[Exception]
- private[dialog] def test3(): Unit = f(
- "a4" → null,
- "a1" → "onA1",
- "a1" → "onA1",
- "a4" → "onA4",
- "a4" → null
- )
+ private[dialog] def test3(): Unit =
+ f(
+ "a4" → null,
+ "a1" → "onA1",
+ "a1" → "onA1",
+ "a4" → "onA4",
+ "a4" → "onA4"
+ )
}