You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nlpcraft.apache.org by se...@apache.org on 2021/02/19 11:00:55 UTC

[incubator-nlpcraft] branch NLPCRAFT-246 created (now be7a330)

This is an automated email from the ASF dual-hosted git repository.

sergeykamov pushed a change to branch NLPCRAFT-246
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git.


      at be7a330  Test added.

This branch includes the following new commits:

     new be7a330  Test added.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[incubator-nlpcraft] 01/01: Test added.

Posted by se...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

sergeykamov pushed a commit to branch NLPCRAFT-246
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git

commit be7a33018658e482c9934963788be5cdb96e3cf0
Author: Sergey Kamov <sk...@gmail.com>
AuthorDate: Fri Feb 19 14:00:43 2021 +0300

    Test added.
---
 .../model/NCEnricherNestedModelSpec2.scala         | 53 ++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/NCEnricherNestedModelSpec2.scala b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/NCEnricherNestedModelSpec2.scala
new file mode 100644
index 0000000..3872867
--- /dev/null
+++ b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/nlp/enrichers/model/NCEnricherNestedModelSpec2.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
+ *
+ *      http://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
+
+/**
+  * Nested Elements test model.
+  */
+class NCNestedTestModel2 extends NCModelAdapter(
+    "nlpcraft.nested2.test.mdl", "Nested Data Test Model", "1.0"
+) {
+    override def getElements: util.Set[NCElement] =
+        Set(NCTestElement("e1", "{^^(id == 'nlpcraft:num')^^|*} word"))
+
+    @NCIntent("intent=onE1 term(t1)={id == 'e1'}")
+    def onAB(ctx: NCIntentMatch): NCResult = NCResult.text("OK")
+
+    @NCIntent("intent=onNumAndE1 term(t1)={id == 'nlpcraft:num'} term(t1)={id == 'e1'}")
+    def onNumAndE1(ctx: NCIntentMatch): NCResult = NCResult.text("OK")
+}
+
+/**
+ * Nested elements model enricher test.
+ */
+@NCTestEnvironment(model = classOf[NCNestedTestModel2], startClient = true)
+class NCEnricherNestedModelSpec2 extends NCTestContext {
+    @Test
+    def test(): Unit = {
+        checkIntent("word", "onE1")
+        checkIntent("10 word", "onE1")
+        checkIntent("10 10 word", "onNumAndE1")
+    }
+}