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 359123f WIP.
359123f is described below
commit 359123f358349e92b2b588c5b54badb84d23de6d
Author: Sergey Kamov <[email protected]>
AuthorDate: Fri Sep 3 12:58:38 2021 +0300
WIP.
---
.../enrichers/model/anyword/NCNestedAnySpec.scala | 45 ++++++++++++++++++++--
...e1.scala => NCNestedTestModelAnyAlphaNum.scala} | 37 +++++++-----------
...m1.scala => NCNestedTestModelAnyNotSpace.scala} | 37 +++++++-----------
...pace1.scala => NCNestedTestModelAnyRegex.scala} | 37 +++++++-----------
.../{ => adapters}/NCNestedModelAnyAdapter.scala | 4 +-
.../NCNestedTestModelAny1.scala} | 9 ++---
.../NCNestedTestModelAny2.scala} | 10 ++---
.../NCNestedTestModelAny3.scala} | 9 ++---
.../NCNestedTestModelAny4.scala} | 9 ++---
.../NCNestedTestModelAny5.scala} | 9 ++---
.../NCNestedTestModelAny6.scala} | 9 ++---
.../NCNestedTestModelAny7.scala} | 9 ++---
12 files changed, 111 insertions(+), 113 deletions(-)
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/NCNestedAnySpec.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/NCNestedAnySpec.scala
index 4e1a84e..fafd103 100644
---
a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/NCNestedAnySpec.scala
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/NCNestedAnySpec.scala
@@ -17,12 +17,12 @@
package org.apache.nlpcraft.probe.mgrs.nlp.enrichers.model.anyword
-import
org.apache.nlpcraft.probe.mgrs.nlp.enrichers.model.anyword.alphanum.NCNestedTestModelAnyAlphaNum1
-import org.apache.nlpcraft.probe.mgrs.nlp.enrichers.model.anyword.regex._
-import
org.apache.nlpcraft.probe.mgrs.nlp.enrichers.model.anyword.space.NCNestedTestModelAnyNotSpace1
import org.apache.nlpcraft.{NCTestContext, NCTestEnvironment}
import org.junit.jupiter.api.Test
+/**
+ *
+ */
class NCNestedAnySpec extends NCTestContext {
private def test(): Unit = {
// 1, 2 and 3 any words should be suitable.
@@ -46,7 +46,7 @@ class NCNestedAnySpec extends NCTestContext {
@Test @NCTestEnvironment(model = classOf[NCNestedTestModelAnyRegex3],
startClient = true)
def testRegex3(): Unit = test()
- @Test @NCTestEnvironment(model = classOf[NCNestedTestModelAnyRegex4],
startClient = true)
+ @Test @NCTestEnvironment(model = classOf[NCNestedTestModelAnyRegex5],
startClient = true)
def testRegex4(): Unit = test()
@Test @NCTestEnvironment(model = classOf[NCNestedTestModelAnyRegex5],
startClient = true)
@@ -61,6 +61,43 @@ class NCNestedAnySpec extends NCTestContext {
@Test @NCTestEnvironment(model = classOf[NCNestedTestModelAnyAlphaNum1],
startClient = true)
def testAlphaNum1(): Unit = test()
+ @Test @NCTestEnvironment(model = classOf[NCNestedTestModelAnyAlphaNum2],
startClient = true)
+ def testAlphaNum2(): Unit = test()
+
+ @Test @NCTestEnvironment(model = classOf[NCNestedTestModelAnyAlphaNum3],
startClient = true)
+ def testAlphaNum3(): Unit = test()
+
+ @Test @NCTestEnvironment(model = classOf[NCNestedTestModelAnyAlphaNum4],
startClient = true)
+ def testAlphaNum4(): Unit = test()
+
+ @Test @NCTestEnvironment(model = classOf[NCNestedTestModelAnyAlphaNum5],
startClient = true)
+ def testAlphaNum5(): Unit = test()
+
+ @Test @NCTestEnvironment(model = classOf[NCNestedTestModelAnyAlphaNum6],
startClient = true)
+ def testAlphaNum6(): Unit = test()
+
+ @Test @NCTestEnvironment(model = classOf[NCNestedTestModelAnyAlphaNum7],
startClient = true)
+ def testAlphaNum7(): Unit = test()
+
@Test @NCTestEnvironment(model = classOf[NCNestedTestModelAnyNotSpace1],
startClient = true)
def testNotSpaceNum1(): Unit = test()
+
+ @Test @NCTestEnvironment(model = classOf[NCNestedTestModelAnyNotSpace2],
startClient = true)
+ def testNotSpaceNum2(): Unit = test()
+
+ @Test @NCTestEnvironment(model = classOf[NCNestedTestModelAnyNotSpace3],
startClient = true)
+ def testNotSpaceNum3(): Unit = test()
+
+ @Test @NCTestEnvironment(model = classOf[NCNestedTestModelAnyNotSpace4],
startClient = true)
+ def testNotSpaceNum4(): Unit = test()
+
+ @Test @NCTestEnvironment(model = classOf[NCNestedTestModelAnyNotSpace5],
startClient = true)
+ def testNotSpaceNum5(): Unit = test()
+
+ @Test @NCTestEnvironment(model = classOf[NCNestedTestModelAnyNotSpace6],
startClient = true)
+ def testNotSpaceNum6(): Unit = test()
+
+ @Test @NCTestEnvironment(model = classOf[NCNestedTestModelAnyNotSpace7],
startClient = true)
+ def testNotSpaceNum7(): Unit = test()
+
}
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/space/NCNestedTestModelAnyNotSpace1.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/NCNestedTestModelAnyAlphaNum.scala
similarity index 50%
copy from
nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/space/NCNestedTestModelAnyNotSpace1.scala
copy to
nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/NCNestedTestModelAnyAlphaNum.scala
index 6769418..32df509 100644
---
a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/space/NCNestedTestModelAnyNotSpace1.scala
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/NCNestedTestModelAnyAlphaNum.scala
@@ -15,32 +15,21 @@
* limitations under the License.
*/
-package org.apache.nlpcraft.probe.mgrs.nlp.enrichers.model.anyword.space
+package org.apache.nlpcraft.probe.mgrs.nlp.enrichers.model.anyword
-import org.apache.nlpcraft.NCTestElement
-import org.apache.nlpcraft.model.{NCElement, NCIntent, NCResult}
-import
org.apache.nlpcraft.probe.mgrs.nlp.enrichers.model.anyword.NCNestedModelAnyAdapter
-
-import java.util
-import scala.jdk.CollectionConverters.SetHasAsJava
+import org.apache.nlpcraft.probe.mgrs.nlp.enrichers.model.anyword.adapters._
/**
- * 'any' ('not greedy') element - alpha_num.
- * 'compose' element.
- * intent without DSL.
- * 'any' element's position is not restricted.
+ *
*/
-class NCNestedTestModelAnyNotSpace1 extends NCNestedModelAnyAdapter {
- override def getAbstractTokens: util.Set[String] = Set("a", "b",
"any").asJava
-
- override def getElements: util.Set[NCElement] =
- Set(
- NCTestElement("a"),
- NCTestElement("b"),
- mkNotGreedy("any", "{^^{tok_txt != ' '}^^}[1, 3]"),
- NCTestElement("compose", "^^{# == 'a'}^^ ^^{# == 'any'}^^ ^^{# ==
'b'}^^")
- )
+trait NCNestedTestModelAnyAlphaNum extends NCNestedModelAnyAdapter {
+ override def anyDefinition: String = "{^^{is_alphanum(tok_txt)}^^}"
+}
- @NCIntent("intent=compose term(x)={# == 'compose'}")
- private def onCompose(): NCResult = NCResult.text("OK")
-}
\ No newline at end of file
+class NCNestedTestModelAnyAlphaNum1 extends NCNestedTestModelAny1 with
NCNestedTestModelAnyAlphaNum
+class NCNestedTestModelAnyAlphaNum2 extends NCNestedTestModelAny2 with
NCNestedTestModelAnyAlphaNum
+class NCNestedTestModelAnyAlphaNum3 extends NCNestedTestModelAny3 with
NCNestedTestModelAnyAlphaNum
+class NCNestedTestModelAnyAlphaNum4 extends NCNestedTestModelAny4 with
NCNestedTestModelAnyAlphaNum
+class NCNestedTestModelAnyAlphaNum5 extends NCNestedTestModelAny5 with
NCNestedTestModelAnyAlphaNum
+class NCNestedTestModelAnyAlphaNum6 extends NCNestedTestModelAny6 with
NCNestedTestModelAnyAlphaNum
+class NCNestedTestModelAnyAlphaNum7 extends NCNestedTestModelAny7 with
NCNestedTestModelAnyAlphaNum
\ No newline at end of file
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/alphanum/NCNestedTestModelAnyAlphaNum1.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/NCNestedTestModelAnyNotSpace.scala
similarity index 50%
rename from
nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/alphanum/NCNestedTestModelAnyAlphaNum1.scala
rename to
nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/NCNestedTestModelAnyNotSpace.scala
index 4fdf029..dd5ba28 100644
---
a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/alphanum/NCNestedTestModelAnyAlphaNum1.scala
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/NCNestedTestModelAnyNotSpace.scala
@@ -15,32 +15,21 @@
* limitations under the License.
*/
-package org.apache.nlpcraft.probe.mgrs.nlp.enrichers.model.anyword.alphanum
+package org.apache.nlpcraft.probe.mgrs.nlp.enrichers.model.anyword
-import org.apache.nlpcraft.NCTestElement
-import org.apache.nlpcraft.model.{NCElement, NCIntent, NCResult}
-import
org.apache.nlpcraft.probe.mgrs.nlp.enrichers.model.anyword.NCNestedModelAnyAdapter
-
-import java.util
-import scala.jdk.CollectionConverters.SetHasAsJava
+import org.apache.nlpcraft.probe.mgrs.nlp.enrichers.model.anyword.adapters._
/**
- * 'any' ('not greedy') element - alpha_num.
- * 'compose' element.
- * intent without DSL.
- * 'any' element's position is not restricted.
+ *
*/
-class NCNestedTestModelAnyAlphaNum1 extends NCNestedModelAnyAdapter {
- override def getAbstractTokens: util.Set[String] = Set("a", "b",
"any").asJava
-
- override def getElements: util.Set[NCElement] =
- Set(
- NCTestElement("a"),
- NCTestElement("b"),
- mkNotGreedy("any", "{^^{is_alphanum(tok_txt)}^^}[1, 3]"),
- NCTestElement("compose", "^^{# == 'a'}^^ ^^{# == 'any'}^^ ^^{# ==
'b'}^^")
- )
+trait NCNestedTestModelAnyNotSpace extends NCNestedModelAnyAdapter {
+ override def anyDefinition: String = "{^^{tok_txt != ' '}^^}"
+}
- @NCIntent("intent=compose term(x)={# == 'compose'}")
- private def onCompose(): NCResult = NCResult.text("OK")
-}
\ No newline at end of file
+class NCNestedTestModelAnyNotSpace1 extends NCNestedTestModelAny1 with
NCNestedTestModelAnyNotSpace
+class NCNestedTestModelAnyNotSpace2 extends NCNestedTestModelAny2 with
NCNestedTestModelAnyNotSpace
+class NCNestedTestModelAnyNotSpace3 extends NCNestedTestModelAny3 with
NCNestedTestModelAnyNotSpace
+class NCNestedTestModelAnyNotSpace4 extends NCNestedTestModelAny4 with
NCNestedTestModelAnyNotSpace
+class NCNestedTestModelAnyNotSpace5 extends NCNestedTestModelAny5 with
NCNestedTestModelAnyNotSpace
+class NCNestedTestModelAnyNotSpace6 extends NCNestedTestModelAny6 with
NCNestedTestModelAnyNotSpace
+class NCNestedTestModelAnyNotSpace7 extends NCNestedTestModelAny7 with
NCNestedTestModelAnyNotSpace
\ No newline at end of file
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/space/NCNestedTestModelAnyNotSpace1.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/NCNestedTestModelAnyRegex.scala
similarity index 50%
rename from
nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/space/NCNestedTestModelAnyNotSpace1.scala
rename to
nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/NCNestedTestModelAnyRegex.scala
index 6769418..7a1fd71 100644
---
a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/space/NCNestedTestModelAnyNotSpace1.scala
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/NCNestedTestModelAnyRegex.scala
@@ -15,32 +15,21 @@
* limitations under the License.
*/
-package org.apache.nlpcraft.probe.mgrs.nlp.enrichers.model.anyword.space
+package org.apache.nlpcraft.probe.mgrs.nlp.enrichers.model.anyword
-import org.apache.nlpcraft.NCTestElement
-import org.apache.nlpcraft.model.{NCElement, NCIntent, NCResult}
-import
org.apache.nlpcraft.probe.mgrs.nlp.enrichers.model.anyword.NCNestedModelAnyAdapter
-
-import java.util
-import scala.jdk.CollectionConverters.SetHasAsJava
+import org.apache.nlpcraft.probe.mgrs.nlp.enrichers.model.anyword.adapters._
/**
- * 'any' ('not greedy') element - alpha_num.
- * 'compose' element.
- * intent without DSL.
- * 'any' element's position is not restricted.
+ *
*/
-class NCNestedTestModelAnyNotSpace1 extends NCNestedModelAnyAdapter {
- override def getAbstractTokens: util.Set[String] = Set("a", "b",
"any").asJava
-
- override def getElements: util.Set[NCElement] =
- Set(
- NCTestElement("a"),
- NCTestElement("b"),
- mkNotGreedy("any", "{^^{tok_txt != ' '}^^}[1, 3]"),
- NCTestElement("compose", "^^{# == 'a'}^^ ^^{# == 'any'}^^ ^^{# ==
'b'}^^")
- )
+trait NCNestedTestModelAnyRegex extends NCNestedModelAnyAdapter {
+ override def anyDefinition: String = "{//[a-zA-Z0-9]+//}"
+}
- @NCIntent("intent=compose term(x)={# == 'compose'}")
- private def onCompose(): NCResult = NCResult.text("OK")
-}
\ No newline at end of file
+class NCNestedTestModelAnyRegex1 extends NCNestedTestModelAny1 with
NCNestedTestModelAnyRegex
+class NCNestedTestModelAnyRegex2 extends NCNestedTestModelAny2 with
NCNestedTestModelAnyRegex
+class NCNestedTestModelAnyRegex3 extends NCNestedTestModelAny3 with
NCNestedTestModelAnyRegex
+class NCNestedTestModelAnyRegex4 extends NCNestedTestModelAny4 with
NCNestedTestModelAnyRegex
+class NCNestedTestModelAnyRegex5 extends NCNestedTestModelAny5 with
NCNestedTestModelAnyRegex
+class NCNestedTestModelAnyRegex6 extends NCNestedTestModelAny6 with
NCNestedTestModelAnyRegex
+class NCNestedTestModelAnyRegex7 extends NCNestedTestModelAny7 with
NCNestedTestModelAnyRegex
\ No newline at end of file
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/NCNestedModelAnyAdapter.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/adapters/NCNestedModelAnyAdapter.scala
similarity index 97%
rename from
nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/NCNestedModelAnyAdapter.scala
rename to
nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/adapters/NCNestedModelAnyAdapter.scala
index d749656..0627c6e 100644
---
a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/NCNestedModelAnyAdapter.scala
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/adapters/NCNestedModelAnyAdapter.scala
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.nlpcraft.probe.mgrs.nlp.enrichers.model.anyword
+package org.apache.nlpcraft.probe.mgrs.nlp.enrichers.model.anyword.adapters
import org.apache.nlpcraft.NCTestElement
import org.apache.nlpcraft.model.NCModelAdapter
@@ -37,4 +37,6 @@ abstract class NCNestedModelAnyAdapter extends
NCModelAdapter("nlpcraft.test.mdl
e
}
+
+ def anyDefinition: String
}
\ No newline at end of file
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/regex/NCNestedTestModelAnyRegex1.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/adapters/NCNestedTestModelAny1.scala
similarity index 85%
rename from
nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/regex/NCNestedTestModelAnyRegex1.scala
rename to
nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/adapters/NCNestedTestModelAny1.scala
index 334aacb..de70e71 100644
---
a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/regex/NCNestedTestModelAnyRegex1.scala
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/adapters/NCNestedTestModelAny1.scala
@@ -15,11 +15,10 @@
* limitations under the License.
*/
-package org.apache.nlpcraft.probe.mgrs.nlp.enrichers.model.anyword.regex
+package org.apache.nlpcraft.probe.mgrs.nlp.enrichers.model.anyword.adapters
import org.apache.nlpcraft.NCTestElement
import org.apache.nlpcraft.model.{NCElement, NCIntent, NCResult}
-import
org.apache.nlpcraft.probe.mgrs.nlp.enrichers.model.anyword.NCNestedModelAnyAdapter
import java.util
import scala.jdk.CollectionConverters.SetHasAsJava
@@ -30,7 +29,7 @@ import scala.jdk.CollectionConverters.SetHasAsJava
* intent without DSL.
* 'any' element's position is not restricted.
*/
-class NCNestedTestModelAnyRegex1 extends NCNestedModelAnyAdapter {
+abstract class NCNestedTestModelAny1 extends NCNestedModelAnyAdapter {
override def getAbstractTokens: util.Set[String] = Set("a", "b",
"any").asJava
// Variants:
@@ -43,10 +42,10 @@ class NCNestedTestModelAnyRegex1 extends
NCNestedModelAnyAdapter {
Set(
NCTestElement("a"),
NCTestElement("b"),
- mkNotGreedy("any", "{//[a-zA-Z0-9]+//}[1, 3]"),
+ mkNotGreedy("any", s"$anyDefinition[1, 3]"),
NCTestElement("compose", "^^{# == 'a'}^^ ^^{# == 'any'}^^ ^^{# ==
'b'}^^")
)
@NCIntent("intent=compose term(x)={# == 'compose'}")
- private def onCompose(): NCResult = NCResult.text("OK")
+ def onCompose(): NCResult = NCResult.text("OK")
}
\ No newline at end of file
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/regex/NCNestedTestModelAnyRegex2.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/adapters/NCNestedTestModelAny2.scala
similarity index 83%
rename from
nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/regex/NCNestedTestModelAnyRegex2.scala
rename to
nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/adapters/NCNestedTestModelAny2.scala
index 8b25edd..74218ee 100644
---
a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/regex/NCNestedTestModelAnyRegex2.scala
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/adapters/NCNestedTestModelAny2.scala
@@ -15,14 +15,12 @@
* limitations under the License.
*/
-package org.apache.nlpcraft.probe.mgrs.nlp.enrichers.model.anyword.regex
+package org.apache.nlpcraft.probe.mgrs.nlp.enrichers.model.anyword.adapters
import org.apache.nlpcraft.NCTestElement
import org.apache.nlpcraft.model.{NCElement, NCIntent, NCResult}
-import
org.apache.nlpcraft.probe.mgrs.nlp.enrichers.model.anyword.NCNestedModelAnyAdapter
import java.util
-import scala.jdk.CollectionConverters.SetHasAsJava
/**
* 'any' ('not greedy') element - regex.
@@ -30,7 +28,7 @@ import scala.jdk.CollectionConverters.SetHasAsJava
* intent without DSL.
* 'any' element's position is restricted.
*/
-class NCNestedTestModelAnyRegex2 extends NCNestedModelAnyAdapter {
+abstract class NCNestedTestModelAny2 extends NCNestedModelAnyAdapter {
//override def getAbstractTokens: util.Set[String] = Set("a", "b",
"any").asJava
// Variants:
@@ -43,12 +41,12 @@ class NCNestedTestModelAnyRegex2 extends
NCNestedModelAnyAdapter {
Set(
NCTestElement("a"),
NCTestElement("b"),
- mkNotGreedy("any", "{//[a-zA-Z0-9]+//}[1, 3]"),
+ mkNotGreedy("any", s"$anyDefinition[1, 3]"),
NCTestElement(
"compose", "^^{# == 'a'}^^ ^^{# == 'any' &&
tok_is_between_ids('a', 'b') == true}^^ ^^{# == 'b'}^^"
)
)
@NCIntent("intent=compose term(x)={# == 'compose'}")
- private def onCompose(): NCResult = NCResult.text("OK")
+ def onCompose(): NCResult = NCResult.text("OK")
}
\ No newline at end of file
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/regex/NCNestedTestModelAnyRegex3.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/adapters/NCNestedTestModelAny3.scala
similarity index 83%
rename from
nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/regex/NCNestedTestModelAnyRegex3.scala
rename to
nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/adapters/NCNestedTestModelAny3.scala
index 9af7e88..ce3dcf8 100644
---
a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/regex/NCNestedTestModelAnyRegex3.scala
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/adapters/NCNestedTestModelAny3.scala
@@ -15,11 +15,10 @@
* limitations under the License.
*/
-package org.apache.nlpcraft.probe.mgrs.nlp.enrichers.model.anyword.regex
+package org.apache.nlpcraft.probe.mgrs.nlp.enrichers.model.anyword.adapters
import org.apache.nlpcraft.NCTestElement
import org.apache.nlpcraft.model.{NCElement, NCIntent, NCResult}
-import
org.apache.nlpcraft.probe.mgrs.nlp.enrichers.model.anyword.NCNestedModelAnyAdapter
import java.util
import scala.jdk.CollectionConverters.SetHasAsJava
@@ -29,7 +28,7 @@ import scala.jdk.CollectionConverters.SetHasAsJava
* intent without DSL.
* 'any' element's position is restricted implicitly via synonym definition.
*/
-class NCNestedTestModelAnyRegex3 extends NCNestedModelAnyAdapter {
+abstract class NCNestedTestModelAny3 extends NCNestedModelAnyAdapter {
override def getAbstractTokens: util.Set[String] = Set("a", "b").asJava
// Variants:
@@ -42,9 +41,9 @@ class NCNestedTestModelAnyRegex3 extends
NCNestedModelAnyAdapter {
Set(
NCTestElement("a"),
NCTestElement("b"),
- NCTestElement("compose", "^^{# == 'a'}^^ {//[a-zA-Z0-9]+//}[1, 3]
^^{# == 'b'}^^")
+ NCTestElement("compose", s"^^{# == 'a'}^^ $anyDefinition[1, 3]
^^{# == 'b'}^^")
)
@NCIntent("intent=compose term(x)={# == 'compose'}")
- private def onCompose(): NCResult = NCResult.text("OK")
+ def onCompose(): NCResult = NCResult.text("OK")
}
\ No newline at end of file
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/regex/NCNestedTestModelAnyRegex4.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/adapters/NCNestedTestModelAny4.scala
similarity index 85%
rename from
nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/regex/NCNestedTestModelAnyRegex4.scala
rename to
nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/adapters/NCNestedTestModelAny4.scala
index f17b651..e1fc89d 100644
---
a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/regex/NCNestedTestModelAnyRegex4.scala
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/adapters/NCNestedTestModelAny4.scala
@@ -15,11 +15,10 @@
* limitations under the License.
*/
-package org.apache.nlpcraft.probe.mgrs.nlp.enrichers.model.anyword.regex
+package org.apache.nlpcraft.probe.mgrs.nlp.enrichers.model.anyword.adapters
import org.apache.nlpcraft.NCTestElement
import org.apache.nlpcraft.model.{NCElement, NCIntent, NCResult}
-import
org.apache.nlpcraft.probe.mgrs.nlp.enrichers.model.anyword.NCNestedModelAnyAdapter
import java.util
import scala.jdk.CollectionConverters.SetHasAsJava
@@ -30,7 +29,7 @@ import scala.jdk.CollectionConverters.SetHasAsJava
* intent with DSL.
* 'any' element's position is not restricted (IDL).
*/
-class NCNestedTestModelAnyRegex4 extends NCNestedModelAnyAdapter {
+abstract class NCNestedTestModelAny4 extends NCNestedModelAnyAdapter {
override def getAbstractTokens: util.Set[String] = Set.empty[String].asJava
// Variants:
@@ -43,7 +42,7 @@ class NCNestedTestModelAnyRegex4 extends
NCNestedModelAnyAdapter {
Set(
NCTestElement("a"),
NCTestElement("b"),
- mkNotGreedy("any", "{//[a-zA-Z0-9]+//}[1, 3]")
+ mkNotGreedy("any", s"$anyDefinition[1, 3]")
)
@NCIntent(
@@ -52,5 +51,5 @@ class NCNestedTestModelAnyRegex4 extends
NCNestedModelAnyAdapter {
" term(any)={# == 'any'} " +
" term(b)={# == 'b'}"
)
- private def onCompose(): NCResult = NCResult.text("OK")
+ def onCompose(): NCResult = NCResult.text("OK")
}
\ No newline at end of file
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/regex/NCNestedTestModelAnyRegex5.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/adapters/NCNestedTestModelAny5.scala
similarity index 86%
rename from
nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/regex/NCNestedTestModelAnyRegex5.scala
rename to
nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/adapters/NCNestedTestModelAny5.scala
index 3293dfe..8bcdd7f 100644
---
a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/regex/NCNestedTestModelAnyRegex5.scala
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/adapters/NCNestedTestModelAny5.scala
@@ -15,11 +15,10 @@
* limitations under the License.
*/
-package org.apache.nlpcraft.probe.mgrs.nlp.enrichers.model.anyword.regex
+package org.apache.nlpcraft.probe.mgrs.nlp.enrichers.model.anyword.adapters
import org.apache.nlpcraft.NCTestElement
import org.apache.nlpcraft.model.{NCElement, NCIntent, NCResult}
-import
org.apache.nlpcraft.probe.mgrs.nlp.enrichers.model.anyword.NCNestedModelAnyAdapter
import java.util
import scala.jdk.CollectionConverters.SetHasAsJava
@@ -30,7 +29,7 @@ import scala.jdk.CollectionConverters.SetHasAsJava
* intent with DSL.
* 'any' element's position is not restricted (IDL).
*/
-class NCNestedTestModelAnyRegex5 extends NCNestedModelAnyAdapter {
+abstract class NCNestedTestModelAny5 extends NCNestedModelAnyAdapter {
override def getAbstractTokens: util.Set[String] = Set.empty[String].asJava
// Variants:
@@ -43,7 +42,7 @@ class NCNestedTestModelAnyRegex5 extends
NCNestedModelAnyAdapter {
Set(
NCTestElement("a"),
NCTestElement("b"),
- mkNotGreedy("any", "{//[a-zA-Z0-9]+//}")
+ mkNotGreedy("any", anyDefinition)
)
@NCIntent(
@@ -52,5 +51,5 @@ class NCNestedTestModelAnyRegex5 extends
NCNestedModelAnyAdapter {
" term(any)={# == 'any'}[1, 3] " +
" term(b)={# == 'b'}"
)
- private def onCompose(): NCResult = NCResult.text("OK")
+ def onCompose(): NCResult = NCResult.text("OK")
}
\ No newline at end of file
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/regex/NCNestedTestModelAnyRegex6.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/adapters/NCNestedTestModelAny6.scala
similarity index 86%
rename from
nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/regex/NCNestedTestModelAnyRegex6.scala
rename to
nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/adapters/NCNestedTestModelAny6.scala
index 6015812..d63151b 100644
---
a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/regex/NCNestedTestModelAnyRegex6.scala
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/adapters/NCNestedTestModelAny6.scala
@@ -15,11 +15,10 @@
* limitations under the License.
*/
-package org.apache.nlpcraft.probe.mgrs.nlp.enrichers.model.anyword.regex
+package org.apache.nlpcraft.probe.mgrs.nlp.enrichers.model.anyword.adapters
import org.apache.nlpcraft.NCTestElement
import org.apache.nlpcraft.model.{NCElement, NCIntent, NCResult}
-import
org.apache.nlpcraft.probe.mgrs.nlp.enrichers.model.anyword.NCNestedModelAnyAdapter
import java.util
import scala.jdk.CollectionConverters.SetHasAsJava
@@ -30,7 +29,7 @@ import scala.jdk.CollectionConverters.SetHasAsJava
* intent with DSL.
* 'any' element's position is restricted (IDL).
*/
-class NCNestedTestModelAnyRegex6 extends NCNestedModelAnyAdapter {
+abstract class NCNestedTestModelAny6 extends NCNestedModelAnyAdapter {
override def getAbstractTokens: util.Set[String] = Set.empty[String].asJava
// Variants:
@@ -43,7 +42,7 @@ class NCNestedTestModelAnyRegex6 extends
NCNestedModelAnyAdapter {
Set(
NCTestElement("a"),
NCTestElement("b"),
- mkNotGreedy("any", "{//[a-zA-Z0-9]+//}[1, 3]")
+ mkNotGreedy("any", s"$anyDefinition[1, 3]")
)
@NCIntent(
@@ -52,5 +51,5 @@ class NCNestedTestModelAnyRegex6 extends
NCNestedModelAnyAdapter {
" term(any)={# == 'any' && tok_is_between_ids('a', 'b') == true} " +
" term(b)={# == 'b'}"
)
- private def onCompose(): NCResult = NCResult.text("OK")
+ def onCompose(): NCResult = NCResult.text("OK")
}
\ No newline at end of file
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/regex/NCNestedTestModelAnyRegex7.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/adapters/NCNestedTestModelAny7.scala
similarity index 86%
rename from
nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/regex/NCNestedTestModelAnyRegex7.scala
rename to
nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/adapters/NCNestedTestModelAny7.scala
index 8135540..384cb26 100644
---
a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/regex/NCNestedTestModelAnyRegex7.scala
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/adapters/NCNestedTestModelAny7.scala
@@ -15,11 +15,10 @@
* limitations under the License.
*/
-package org.apache.nlpcraft.probe.mgrs.nlp.enrichers.model.anyword.regex
+package org.apache.nlpcraft.probe.mgrs.nlp.enrichers.model.anyword.adapters
import org.apache.nlpcraft.NCTestElement
import org.apache.nlpcraft.model.{NCElement, NCIntent, NCResult}
-import
org.apache.nlpcraft.probe.mgrs.nlp.enrichers.model.anyword.NCNestedModelAnyAdapter
import java.util
import scala.jdk.CollectionConverters.SetHasAsJava
@@ -30,7 +29,7 @@ import scala.jdk.CollectionConverters.SetHasAsJava
* intent with DSL.
* 'any' element's position is restricted (IDL).
*/
-class NCNestedTestModelAnyRegex7 extends NCNestedModelAnyAdapter {
+abstract class NCNestedTestModelAny7 extends NCNestedModelAnyAdapter {
override def getAbstractTokens: util.Set[String] = Set.empty[String].asJava
// Variants:
@@ -43,7 +42,7 @@ class NCNestedTestModelAnyRegex7 extends
NCNestedModelAnyAdapter {
Set(
NCTestElement("a"),
NCTestElement("b"),
- mkNotGreedy("any", "{//[a-zA-Z0-9]+//}")
+ mkNotGreedy("any", anyDefinition)
)
@NCIntent(
@@ -52,5 +51,5 @@ class NCNestedTestModelAnyRegex7 extends
NCNestedModelAnyAdapter {
" term(any)={# == 'any' && tok_is_between_ids('a', 'b') == true}[1,
3] " +
" term(b)={# == 'b'}"
)
- private def onCompose(): NCResult = NCResult.text("OK")
+ def onCompose(): NCResult = NCResult.text("OK")
}
\ No newline at end of file