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 a036639 WIP.
a036639 is described below
commit a036639ac0cc1b1e812f576b1d1787a1906d462e
Author: Sergey Kamov <[email protected]>
AuthorDate: Mon Aug 30 19:10:19 2021 +0300
WIP.
---
...xSpec5.scala => NCNestedAnyNotSpacySpec1.scala} | 30 ++++++++++------------
.../model/anyword/NCNestedAnyRegexSpec4.scala | 12 ++++-----
.../model/anyword/NCNestedAnyRegexSpec5.scala | 12 ++++-----
3 files changed, 26 insertions(+), 28 deletions(-)
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/NCNestedAnyRegexSpec5.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/NCNestedAnyNotSpacySpec1.scala
similarity index 63%
copy from
nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/NCNestedAnyRegexSpec5.scala
copy to
nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/NCNestedAnyNotSpacySpec1.scala
index 9ab4771..6c8e3ba 100644
---
a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/NCNestedAnyRegexSpec5.scala
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/NCNestedAnyNotSpacySpec1.scala
@@ -24,30 +24,28 @@ import java.util
import scala.jdk.CollectionConverters.SetHasAsJava
/**
- * 'any' ('not greedy') element - regex.
- * no 'compose' element.
- * intent with DSL.
- * 'any' element's position is not restricted (IDL).
+ * 'any' ('not greedy') element - alpha_num.
+ * 'compose' element.
+ * intent without DSL.
+ * 'any' element's position is not restricted.
*/
-class NCNestedTestModelAnyRegex5 extends NCNestedTestModelAnyAdapter {
- override def getAbstractTokens: util.Set[String] = Set.empty[String].asJava
+class NCNestedTestModelAnyAlphaNum1 extends NCNestedTestModelAnyAdapter {
+ override def getAbstractTokens: util.Set[String] = Set("a", "b",
"any").asJava
override def getElements: util.Set[NCElement] =
Set(
NCTestElement("a"),
NCTestElement("b"),
- mkNotGreedy("any", "{//[a-zA-Z0-9]+//}[1, 3]")
+ mkNotGreedy("any", "tok_txt != ' '"),
+ NCTestElement(
+ "compose",
+ "^^{# == 'a'}^^ ^^{# == 'any'}^^ ^^{# == 'b'}^^"
+ )
)
- @NCIntent(
- "intent=compose " +
- " options={'ordered': true, 'unused_free_words': false}" +
- " term(a)={# == 'a'}" +
- " term(any)={# == 'any'}[1,3] " +
- " term(b)={# == 'b'}"
- )
+ @NCIntent("intent=compose term(x)={# == 'compose'}")
private def onCompose(): NCResult = NCResult.text("OK")
}
-@NCTestEnvironment(model = classOf[NCNestedTestModelAnyRegex5], startClient =
true)
-class NCNestedAnyRegexSpec5 extends NCNestedAnySpecAdapter
+@NCTestEnvironment(model = classOf[NCNestedTestModelAnyAlphaNum1], startClient
= true)
+class NCNestedAnyAlphaNumSpec1 extends NCNestedAnySpecAdapter
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/NCNestedAnyRegexSpec4.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/NCNestedAnyRegexSpec4.scala
index 23fe22e..0bffdf0 100644
---
a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/NCNestedAnyRegexSpec4.scala
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/NCNestedAnyRegexSpec4.scala
@@ -27,7 +27,7 @@ import scala.jdk.CollectionConverters.SetHasAsJava
* 'any' ('not greedy') element - regex.
* no 'compose' element.
* intent with DSL.
- * 'any' element's position is restricted (IDL).
+ * 'any' element's position is not restricted (IDL).
*/
class NCNestedTestModelAnyRegex4 extends NCNestedTestModelAnyAdapter {
override def getAbstractTokens: util.Set[String] = Set.empty[String].asJava
@@ -41,11 +41,11 @@ class NCNestedTestModelAnyRegex4 extends
NCNestedTestModelAnyAdapter {
@NCIntent(
"intent=compose " +
- " options={'ordered': true, 'unused_free_words': false}" +
- " term(a)={# == 'a'}" +
- " term(any)={# == 'any' && tok_is_between_ids('a', 'b') ==
true}[1,3] " +
- " term(b)={# == 'b'}"
- )
+ " options={'ordered': true, 'unused_free_words': false}" +
+ " term(a)={# == 'a'}" +
+ " term(any)={# == 'any'}[1,3] " +
+ " term(b)={# == 'b'}"
+ )
private def onCompose(): NCResult = NCResult.text("OK")
}
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/NCNestedAnyRegexSpec5.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/NCNestedAnyRegexSpec5.scala
index 9ab4771..2861f1e 100644
---
a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/NCNestedAnyRegexSpec5.scala
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/NCNestedAnyRegexSpec5.scala
@@ -27,7 +27,7 @@ import scala.jdk.CollectionConverters.SetHasAsJava
* 'any' ('not greedy') element - regex.
* no 'compose' element.
* intent with DSL.
- * 'any' element's position is not restricted (IDL).
+ * 'any' element's position is restricted (IDL).
*/
class NCNestedTestModelAnyRegex5 extends NCNestedTestModelAnyAdapter {
override def getAbstractTokens: util.Set[String] = Set.empty[String].asJava
@@ -41,11 +41,11 @@ class NCNestedTestModelAnyRegex5 extends
NCNestedTestModelAnyAdapter {
@NCIntent(
"intent=compose " +
- " options={'ordered': true, 'unused_free_words': false}" +
- " term(a)={# == 'a'}" +
- " term(any)={# == 'any'}[1,3] " +
- " term(b)={# == 'b'}"
- )
+ " options={'ordered': true, 'unused_free_words': false}" +
+ " term(a)={# == 'a'}" +
+ " term(any)={# == 'any' && tok_is_between_ids('a', 'b') ==
true}[1,3] " +
+ " term(b)={# == 'b'}"
+ )
private def onCompose(): NCResult = NCResult.text("OK")
}