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
commit 5da094fa93dc93076d4b312aec0fb97b682ae748 Author: Sergey Kamov <[email protected]> AuthorDate: Thu Aug 26 18:06:37 2021 +0300 WIP. --- ...ec41.scala => NCEnricherNestedModelSpec4.scala} | 0 .../model/NCEnricherNestedModelSpec6.scala | 52 ++++++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/NCEnricherNestedModelSpec41.scala b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/NCEnricherNestedModelSpec4.scala similarity index 100% rename from nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/NCEnricherNestedModelSpec41.scala rename to nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/NCEnricherNestedModelSpec4.scala 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 new file mode 100644 index 0000000..4a80e48 --- /dev/null +++ b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/NCEnricherNestedModelSpec6.scala @@ -0,0 +1,52 @@ +/* + * 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, NCModelAdapter} + +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 + +class NCNestedTestModel6 extends NCModelAdapter( + "nlpcraft.nested5.test.mdl", "Nested Data Test Model", "1.0" +) { + override def getElements: util.Set[NCElement] = + Set( + NCTestElement("a"), + NCTestElement("b"), + NCTestElement("any", "{//[a-zA-Z0-9]+//}[1, 3]"), + NCTestElement("compose", "^^[aRef]{tok_id() == 'a'}^^ ^^[anRef]{tok_id() == 'any'}^^ ^^[bRef]{tok_id() == 'b'}^^"), + ) + @NCIntent("intent=compose term(city)={tok_id() == 'compose'}") + private def onCompose(ctx: NCIntentMatch): NCResult = NCResult.text("OK") +} + +/** + * + */ +@NCTestEnvironment(model = classOf[NCNestedTestModel6], startClient = true) +class NCEnricherNestedModelSpec6 extends NCTestContext { + @Test + def test(): Unit = { + checkIntent("a t1 t2 t3 b", "compose") + checkIntent("a t1 t2 b", "compose") + } +}
