WIP on NLPCRAFT-369.
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/common/config/NCConfigurable.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/common/config/NCConfigurable.scala
index 537148e..f7c6ef7 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/common/config/NCConfigurable.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/common/config/NCConfigurable.scala
@@ -330,7 +330,7 @@
val lines = U.splitTrimFilter(cfg.origin().description(),",").drop(1).distinct
- logger.info(s"NLPCraft configuration successfully loaded as a merge of: ${lines.mkString("\n +-- ", "\n +-- ", "")}")
+ logger.info(s"NLPCraft configuration successfully loaded as a merge of: ${lines.mkString(s"\n ${c("+--")} ", s"\n ${c("+--")} ", "")}")
}
// Set parsed configuration into Java shim.
diff --git a/nlpcraft/src/test/scala/org/apache/nlpcraft/NCTestContext.scala b/nlpcraft/src/test/scala/org/apache/nlpcraft/NCTestContext.scala
index ceae8a7..74e0345 100644
--- a/nlpcraft/src/test/scala/org/apache/nlpcraft/NCTestContext.scala
+++ b/nlpcraft/src/test/scala/org/apache/nlpcraft/NCTestContext.scala
@@ -133,11 +133,10 @@
/**
*
- * @param txts
+ * @param txt
*/
- protected def checkFail(txts: String*): Unit =
- for (txt <- txts)
- require(getClient.ask(txt).isFailed)
+ protected def checkFail(txt: String): Unit =
+ require(getClient.ask(txt).isFailed)
/**
* @param req
diff --git a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/options/NCStmOnlySpec.scala b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/options/NCStmOnlySpec.scala
index e41f938..33c670b 100644
--- a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/options/NCStmOnlySpec.scala
+++ b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/options/NCStmOnlySpec.scala
@@ -43,8 +43,8 @@
" 'allow_stm_only': false" +
" }" +
" term(a)={tok_id() == 'a'}" +
- " term(b)={tok_id() == 'b'} " +
- " term(c)={tok_id() == 'c'} " +
+ " term(b)={tok_id() == 'b'}" +
+ " term(c)={tok_id() == 'c'}" +
" term(d)={tok_id() == 'd'}"
)
def before(): NCResult = NCResult.text("before")
@@ -97,7 +97,8 @@
// This should match as 'i1' intent allows:
// - unmatched free words, and
- // - all of its matched tokens to come from STM
+ // - all of its matched tokens to come from STM, and
+ // - its terms are conversational (~).
checkResult("x y", "i1")
}
@@ -112,4 +113,18 @@
checkResult("c d", "i2")
}
+
+ @Test
+ def test3(): Unit = {
+ clear()
+
+ checkResult("a b c d", "before")
+ checkResult("b a d c", "before")
+ checkResult("a b", "i1")
+
+ clear()
+
+ // This should NOT match because STM is cleared.
+ checkFail("x y")
+ }
}
diff --git a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/properties/NCTokensPropertiesSpec.scala b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/properties/NCTokensPropertiesSpec.scala
index 5ab3635..cd7055f 100644
--- a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/properties/NCTokensPropertiesSpec.scala
+++ b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/properties/NCTokensPropertiesSpec.scala
@@ -86,19 +86,17 @@
def test(): Unit = {
checkIntent("a b", "onAB")
checkIntent("a test test b", "onAB")
- checkFail(
- "b a",
- "b test test a"
- )
+
+ checkFail("b a")
+ checkFail("b test test a")
checkIntent("x y", "onXY")
checkIntent("x test test y", "onXY")
- checkFail(
- "b a",
- "b test test a",
- "y x",
- "y test test x"
- )
+
+ checkFail("b a")
+ checkFail("b test test a")
+ checkFail("y x")
+ checkFail("y test test x")
}
}
@@ -117,17 +115,14 @@
checkIntent("y x", "onXY")
checkIntent("x y", "onXY")
- checkFail(
- "a test b",
- "b test a",
- "x test y",
- "y test x",
- "a test test b",
- "b test test a",
- "x test test y",
- "y test test x"
-
- )
+ checkFail("a test b")
+ checkFail("b test a")
+ checkFail("x test y")
+ checkFail("y test x")
+ checkFail("a test test b")
+ checkFail("b test test a")
+ checkFail("x test test y")
+ checkFail("y test test x")
}
}
@@ -142,11 +137,10 @@
@Test
def test(): Unit = {
checkIntent("a b", "onAB")
- checkFail(
- "b a",
- "a test b",
- "b test a"
- )
+
+ checkFail("b a")
+ checkFail("a test b")
+ checkFail("b test a")
}
}
@@ -205,17 +199,15 @@
checkIntent("y x", "onXY")
checkIntent("x y", "onXY")
- checkFail(
- "a test b",
- "b test a"
- )
+ checkFail("a test b")
+ checkFail("b test a")
+
checkIntent("y test x", "onXY")
checkIntent("x test y", "onXY")
- checkFail(
- "a test test b",
- "b test test a"
- )
+ checkFail("a test test b")
+ checkFail("b test test a")
+
checkIntent("y test test x", "onXY")
checkIntent("x test test y", "onXY")
}