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 9211882 WIP.
9211882 is described below
commit 92118820dcccf00856a47c96462749a3f29466b7
Author: Sergey Kamov <[email protected]>
AuthorDate: Thu Sep 2 12:45:49 2021 +0300
WIP.
---
.../anyword/regex/NCNestedTestModelAnyRegex6.scala | 56 ++++++++++++++++++++++
1 file changed, 56 insertions(+)
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/regex/NCNestedTestModelAnyRegex6.scala
new file mode 100644
index 0000000..6015812
--- /dev/null
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/anyword/regex/NCNestedTestModelAnyRegex6.scala
@@ -0,0 +1,56 @@
+/*
+ * 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.regex
+
+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.
+ * no 'compose' element.
+ * intent with DSL.
+ * 'any' element's position is restricted (IDL).
+ */
+class NCNestedTestModelAnyRegex6 extends NCNestedModelAnyAdapter {
+ override def getAbstractTokens: util.Set[String] = Set.empty[String].asJava
+
+ // Variants:
+ // a t1 t2 t3 b - 13
+ // a t1 t2 b - 11
+ // a t1 b - 8
+ // a t1 t2 t3 t4 b - 16
+ // a b - 5
+ 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} " +
+ " term(b)={# == 'b'}"
+ )
+ private def onCompose(): NCResult = NCResult.text("OK")
+}
\ No newline at end of file