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 65ea689 WIP.
65ea689 is described below
commit 65ea689b534acf2e0f220b6e640bc23dc49be91a
Author: Sergey Kamov <[email protected]>
AuthorDate: Mon Aug 30 16:46:27 2021 +0300
WIP.
---
.../model/NCEnricherNestedModelSpec6.scala | 99 ----------------------
.../model/anyword/NCAnyWordSpecAdapters.scala | 55 ++++++++++++
.../model/anyword/NCNestedAnyAlphaNumSpec1.scala | 51 +++++++++++
.../model/anyword/NCNestedAnyRegexSpec1.scala | 51 +++++++++++
.../model/anyword/NCNestedAnyRegexSpec2.scala | 51 +++++++++++
.../model/anyword/NCNestedAnyRegexSpec3.scala | 49 +++++++++++
.../model/anyword/NCNestedAnyRegexSpec4.scala | 53 ++++++++++++
.../model/anyword/NCNestedAnyRegexSpec5.scala | 53 ++++++++++++
8 files changed, 363 insertions(+), 99 deletions(-)
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/NCEnricherNestedModelSpec6.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/NCEnricherNestedModelSpec6.scala
deleted file mode 100644
index 55b0a99..0000000
---
a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/NCEnricherNestedModelSpec6.scala
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.nlpcraft.probe.mgrs.nlp.enrichers.model
-
-import org.apache.nlpcraft.model.{NCElement, NCIntent, NCIntentMatch,
NCModelAdapter, NCResult}
-import org.apache.nlpcraft.{NCTestContext, NCTestElement, NCTestEnvironment}
-import org.junit.jupiter.api.Test
-
-import java.util
-import java.util.Optional
-import scala.jdk.CollectionConverters.SetHasAsJava
-
-class NCNestedTestModel6 extends NCModelAdapter("nlpcraft.nested5.test.mdl",
"Test Model", "1.0") {
- override def getEnabledBuiltInTokens: util.Set[String] =
Set.empty[String].asJava
-
- override def getAbstractTokens: util.Set[String] = Set("a1", "b1", "any1",
"a2", "b2", "any2", "a3", "b3").asJava
-
- override def getElements: util.Set[NCElement] =
- Set(
- NCTestElement("a1"),
- NCTestElement("b1"),
- // We have to define any1 as 'not greedy'.
- { val e = NCTestElement("any1", "{//[a-zA-Z0-9]+//}[1, 3]");
e.greedy = Optional.of(false); e },
- NCTestElement(
- "compose1",
- "^^[a1Ref]{tok_id() == 'a1'}^^ " +
- "^^[any1Ref]{tok_id() == 'any1'}^^ " +
- "^^[b1Ref]{tok_id() == 'b1'}^^"
- ),
-
- NCTestElement("a2"),
- NCTestElement("b2"),
- // We have to define any1 as 'not greedy'.
- { val e = NCTestElement("any2", "{//[a-zA-Z0-9]+//}[1, 3]");
e.greedy = Optional.of(false); e },
- NCTestElement(
- "compose2",
- "^^[a2Ref]{tok_id() == 'a2'}^^ " +
- "^^[any2Ref]{tok_id() == 'any2' && tok_is_between_ids('a2',
'b2') == true}^^ " +
- "^^[b2Ref]{tok_id() == 'b2'}^^"
- ),
-
- NCTestElement("a3"),
- NCTestElement("b3"),
- // We don't have to do anything here with greedy flag.
- NCTestElement(
- "compose3",
- "^^[a3Ref]{tok_id() == 'a3'}^^ " +
- "{//[a-zA-Z0-9]+//}[1, 3] " +
- "^^[b3Ref]{tok_id() == 'b3'}^^"
- )
- )
- @NCIntent("intent=compose1 term(x)={tok_id() == 'compose1'}")
- private def onCompose1(ctx: NCIntentMatch): NCResult = NCResult.text("OK")
-
- @NCIntent("intent=compose2 term(x)={tok_id() == 'compose2'}")
- private def onCompose2(): NCResult = NCResult.text("OK")
-
- @NCIntent("intent=compose3 term(x)={tok_id() == 'compose3'}")
- private def onCompose3(): NCResult = NCResult.text("OK")
-}
-/**
- *
- */
-@NCTestEnvironment(model = classOf[NCNestedTestModel6], startClient = true)
-class NCEnricherNestedModelSpec6 extends NCTestContext {
- private def test(i: Int): Unit = {
- // 1, 2 and 3 any words should be suitable.
- checkIntent(s"a$i t1 t2 t3 b$i", s"compose$i")
- checkIntent(s"a$i t1 t2 b$i", s"compose$i")
- checkIntent(s"a$i t1 b$i", s"compose$i")
-
- // Too many any words.
- checkFail(s"a$i t1 t2 t3 t4 b$i")
- }
-
- @Test
- def testCompose1(): Unit = test(1)
-
- @Test
- def testCompose2(): Unit = test(2)
-
- @Test
- def testCompose3(): Unit = test(3)
-}
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/NCAnyWordSpecAdapters.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/NCAnyWordSpecAdapters.scala
new file mode 100644
index 0000000..8a087c4
--- /dev/null
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/NCAnyWordSpecAdapters.scala
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nlpcraft.probe.mgrs.nlp.enrichers.model.anyword
+
+import org.apache.nlpcraft.model.NCModelAdapter
+import org.apache.nlpcraft.{NCTestContext, NCTestElement}
+import org.junit.jupiter.api.Test
+
+import java.util
+import java.util.Optional
+import scala.jdk.CollectionConverters.SetHasAsJava
+/**
+ *
+ */
+abstract class NCNestedTestModelAnyAdapter extends
NCModelAdapter("nlpcraft.test.mdl", "Test Model", "1.0") {
+ override def getEnabledBuiltInTokens: util.Set[String] =
Set.empty[String].asJava
+
+ protected def mkNotGreedy(id: String, syn: String): NCTestElement = {
+ val e = NCTestElement(id, syn)
+
+ e.greedy = Optional.of(false)
+
+ e
+ }
+}
+/**
+ *
+ */
+abstract class NCNestedAnySpecAdapter extends NCTestContext {
+ @Test
+ def test(): Unit = {
+ // 1, 2 and 3 any words should be suitable.
+ checkIntent("a t1 t2 t3 b", "compose")
+ checkIntent("a t1 t2 b", "compose")
+ checkIntent("a t1 b", "compose")
+
+ // Too many any words.
+ checkFail("a t1 t2 t3 t4 b")
+ }
+}
\ No newline at end of file
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/NCNestedAnyAlphaNumSpec1.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/NCNestedAnyAlphaNumSpec1.scala
new file mode 100644
index 0000000..3b160f4
--- /dev/null
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/NCNestedAnyAlphaNumSpec1.scala
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nlpcraft.probe.mgrs.nlp.enrichers.model.anyword
+
+import org.apache.nlpcraft.model.{NCElement, NCIntent, NCResult}
+import org.apache.nlpcraft.{NCTestElement, NCTestEnvironment}
+
+import java.util
+import scala.jdk.CollectionConverters.SetHasAsJava
+
+/**
+ * 'any' ('not greedy') element - alpha_num.
+ * 'compose' element.
+ * intent without DSL.
+ * 'any' element's position is not restricted.
+ */
+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", "is_alphanum(tok_txt)"),
+ NCTestElement(
+ "compose",
+ "^^{# == 'a'}^^ ^^{# == 'any'}^^ ^^{# == 'b'}^^"
+ )
+ )
+
+ @NCIntent("intent=compose term(x)={# == 'compose'}")
+ private def onCompose(): NCResult = NCResult.text("OK")
+}
+
+@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/NCNestedAnyRegexSpec1.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/NCNestedAnyRegexSpec1.scala
new file mode 100644
index 0000000..6fde495
--- /dev/null
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/NCNestedAnyRegexSpec1.scala
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nlpcraft.probe.mgrs.nlp.enrichers.model.anyword
+
+import org.apache.nlpcraft.model.{NCElement, NCIntent, NCResult}
+import org.apache.nlpcraft.{NCTestElement, NCTestEnvironment}
+
+import java.util
+import scala.jdk.CollectionConverters.SetHasAsJava
+
+/**
+ * 'any' ('not greedy') element - regex.
+ * 'compose' element.
+ * intent without DSL.
+ * 'any' element's position is not restricted.
+ */
+class NCNestedTestModelAnyRegex1 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]"),
+ NCTestElement(
+ "compose",
+ "^^{# == 'a'}^^ ^^{# == 'any'}^^ ^^{# == 'b'}^^"
+ )
+ )
+
+ @NCIntent("intent=compose term(x)={# == 'compose'}")
+ private def onCompose(): NCResult = NCResult.text("OK")
+}
+
+@NCTestEnvironment(model = classOf[NCNestedTestModelAnyRegex1], startClient =
true)
+class NCNestedAnyRegexSpec1 extends NCNestedAnySpecAdapter
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/NCNestedAnyRegexSpec2.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/NCNestedAnyRegexSpec2.scala
new file mode 100644
index 0000000..43887f1
--- /dev/null
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/NCNestedAnyRegexSpec2.scala
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nlpcraft.probe.mgrs.nlp.enrichers.model.anyword
+
+import org.apache.nlpcraft.model.{NCElement, NCIntent, NCResult}
+import org.apache.nlpcraft.{NCTestElement, NCTestEnvironment}
+
+import java.util
+import scala.jdk.CollectionConverters.SetHasAsJava
+
+/**
+ * 'any' ('not greedy') element - regex.
+ * 'compose' element.
+ * intent without DSL.
+ * 'any' element's position is restricted.
+ */
+class NCNestedTestModelAnyRegex2 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]"),
+ 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")
+}
+
+@NCTestEnvironment(model = classOf[NCNestedTestModelAnyRegex2], startClient =
true)
+class NCNestedAnyRegexSpec2 extends NCNestedAnySpecAdapter
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/NCNestedAnyRegexSpec3.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/NCNestedAnyRegexSpec3.scala
new file mode 100644
index 0000000..413d9d1
--- /dev/null
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/NCNestedAnyRegexSpec3.scala
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nlpcraft.probe.mgrs.nlp.enrichers.model.anyword
+
+import org.apache.nlpcraft.model.{NCElement, NCIntent, NCResult}
+import org.apache.nlpcraft.{NCTestElement, NCTestEnvironment}
+
+import java.util
+import scala.jdk.CollectionConverters.SetHasAsJava
+
+/**
+ * 'compose' element with IDL (regex)
+ * intent without DSL.
+ * 'any' element's position is restricted implicitly via synonym definition.
+ */
+class NCNestedTestModelAnyRegex3 extends NCNestedTestModelAnyAdapter {
+ override def getAbstractTokens: util.Set[String] = Set("a", "b").asJava
+
+ override def getElements: util.Set[NCElement] =
+ Set(
+ NCTestElement("a"),
+ NCTestElement("b"),
+ NCTestElement(
+ "compose",
+ "^^{# == 'a'}^^ {//[a-zA-Z0-9]+//}[1, 3] ^^{# == 'b'}^^"
+ )
+ )
+
+ @NCIntent("intent=compose term(x)={# == 'compose'}")
+ private def onCompose(): NCResult = NCResult.text("OK")
+}
+
+@NCTestEnvironment(model = classOf[NCNestedTestModelAnyRegex3], startClient =
true)
+class NCNestedAnyRegexSpec3 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
new file mode 100644
index 0000000..23fe22e
--- /dev/null
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/NCNestedAnyRegexSpec4.scala
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nlpcraft.probe.mgrs.nlp.enrichers.model.anyword
+
+import org.apache.nlpcraft.model.{NCElement, NCIntent, NCResult}
+import org.apache.nlpcraft.{NCTestElement, NCTestEnvironment}
+
+import java.util
+import scala.jdk.CollectionConverters.SetHasAsJava
+
+/**
+ * 'any' ('not greedy') element - regex.
+ * no 'compose' element.
+ * intent with DSL.
+ * 'any' element's position is restricted (IDL).
+ */
+class NCNestedTestModelAnyRegex4 extends NCNestedTestModelAnyAdapter {
+ override def getAbstractTokens: util.Set[String] = Set.empty[String].asJava
+
+ override def getElements: util.Set[NCElement] =
+ Set(
+ NCTestElement("a"),
+ NCTestElement("b"),
+ mkNotGreedy("any", "{//[a-zA-Z0-9]+//}[1, 3]")
+ )
+
+ @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'}"
+ )
+ private def onCompose(): NCResult = NCResult.text("OK")
+}
+
+@NCTestEnvironment(model = classOf[NCNestedTestModelAnyRegex4], startClient =
true)
+class NCNestedAnyRegexSpec4 extends NCNestedAnySpecAdapter
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
new file mode 100644
index 0000000..9ab4771
--- /dev/null
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/NCNestedAnyRegexSpec5.scala
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nlpcraft.probe.mgrs.nlp.enrichers.model.anyword
+
+import org.apache.nlpcraft.model.{NCElement, NCIntent, NCResult}
+import org.apache.nlpcraft.{NCTestElement, NCTestEnvironment}
+
+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).
+ */
+class NCNestedTestModelAnyRegex5 extends NCNestedTestModelAnyAdapter {
+ override def getAbstractTokens: util.Set[String] = Set.empty[String].asJava
+
+ override def getElements: util.Set[NCElement] =
+ Set(
+ NCTestElement("a"),
+ NCTestElement("b"),
+ mkNotGreedy("any", "{//[a-zA-Z0-9]+//}[1, 3]")
+ )
+
+ @NCIntent(
+ "intent=compose " +
+ " 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")
+}
+
+@NCTestEnvironment(model = classOf[NCNestedTestModelAnyRegex5], startClient =
true)
+class NCNestedAnyRegexSpec5 extends NCNestedAnySpecAdapter