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/03/16 10:00:58 UTC

[incubator-nlpcraft] branch NLPCRAFT-206 updated: Temporary simple test on tokens DSL.

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

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


The following commit(s) were added to refs/heads/NLPCRAFT-206 by this push:
     new 424048a  Temporary simple test on tokens DSL.
424048a is described below

commit 424048a7a46572428b6b4fe5e09e8d5779d9207a
Author: Sergey Kamov <sk...@gmail.com>
AuthorDate: Tue Mar 16 13:00:45 2021 +0300

    Temporary simple test on tokens DSL.
---
 .../model/synonyms/NCSynonymsSpecTmp.scala         | 46 ++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/synonyms/NCSynonymsSpecTmp.scala b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/synonyms/NCSynonymsSpecTmp.scala
new file mode 100644
index 0000000..ff0e055
--- /dev/null
+++ b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/synonyms/NCSynonymsSpecTmp.scala
@@ -0,0 +1,46 @@
+/*
+ * 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.model.synonyms
+
+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 NCSynonymsSpecModelTmp extends NCModelAdapter("nlpcraft.syns.test.mdl", "Synonyms Test Model", "1.0") {
+    // Default values.
+    override def isPermutateSynonyms: Boolean = true
+    override def getJiggleFactor: Int = 4
+
+    override def getElements: util.Set[NCElement] =
+        Set(
+            NCTestElement("wrapper", "{^^{id() == 'unknown'}^^}")
+        )
+
+    @NCIntent("intent=onWrapper term(t)={id() == 'wrapper'}")
+    def onWrapper(ctx: NCIntentMatch): NCResult = NCResult.text("OK")
+}
+
+@NCTestEnvironment(model = classOf[NCSynonymsSpecModelTmp], startClient = true)
+class NCSynonymsSpecTmp extends NCTestContext {
+    @Test
+    def test(): Unit = {
+        require(getClient.ask("AAA").isFailed)
+    }
+}