You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nlpcraft.apache.org by ar...@apache.org on 2021/03/20 06:36:08 UTC

[incubator-nlpcraft] branch master updated: WIP.

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

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


The following commit(s) were added to refs/heads/master by this push:
     new b10ffcb  WIP.
b10ffcb is described below

commit b10ffcb5d287107e159eb2375c6c7df941fa298a
Author: Aaron Radzinzski <ar...@datalingvo.com>
AuthorDate: Fri Mar 19 23:35:55 2021 -0700

    WIP.
---
 .../model/{NCIntentDslSpec.scala => NCIdlSpec.scala}         |  6 +++---
 .../model/{NCIntentDslSpec2.scala => NCIdlSpec2.scala}       |  6 +++---
 .../NCIntentDslTestModel.scala => idl/NCIdlTestModel.scala}  |  4 ++--
 .../NCIntentDslTestSpec.scala => idl/NCIdlTestSpec.scala}    | 12 ++++++------
 .../intent/{dsl => idl}/compiler/NCIdlCompilerSpec.scala     | 11 ++++++++---
 .../nlpcraft/model/intent/{dsl => idl}/compiler/test_ok.idl  |  1 +
 .../{dsl/dsl_test_model.yaml => idl/idl_test_model.yaml}     |  0
 7 files changed, 23 insertions(+), 17 deletions(-)

diff --git a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/NCIntentDslSpec.scala b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/NCIdlSpec.scala
similarity index 92%
rename from nlpcraft/src/test/scala/org/apache/nlpcraft/model/NCIntentDslSpec.scala
rename to nlpcraft/src/test/scala/org/apache/nlpcraft/model/NCIdlSpec.scala
index 5cd5c7b..0bba620 100644
--- a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/NCIntentDslSpec.scala
+++ b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/NCIdlSpec.scala
@@ -27,7 +27,7 @@ import scala.language.implicitConversions
 /**
   * IDL test model.
   */
-class NCIntentDslSpecModel extends NCModelAdapter(
+class NCIdlSpecModel extends NCModelAdapter(
     "nlpcraft.intents.dsl.test", "IDL Test Model", "1.0"
 ) {
     private implicit def convert(s: String): NCResult = NCResult.text(s)
@@ -53,8 +53,8 @@ class NCIntentDslSpecModel extends NCModelAdapter(
 /**
   * IDL test.
   */
-@NCTestEnvironment(model = classOf[NCIntentDslSpecModel], startClient = true)
-class NCIntentDslSpec extends NCTestContext {
+@NCTestEnvironment(model = classOf[NCIdlSpecModel], startClient = true)
+class NCIdlSpec extends NCTestContext {
     @Test
     def testBigCity(): Unit = checkIntent("Moscow", "bigCity")
 
diff --git a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/NCIntentDslSpec2.scala b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/NCIdlSpec2.scala
similarity index 92%
rename from nlpcraft/src/test/scala/org/apache/nlpcraft/model/NCIntentDslSpec2.scala
rename to nlpcraft/src/test/scala/org/apache/nlpcraft/model/NCIdlSpec2.scala
index 4484060..3f6143e 100644
--- a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/NCIntentDslSpec2.scala
+++ b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/NCIdlSpec2.scala
@@ -26,7 +26,7 @@ import scala.language.implicitConversions
 /**
   * IDL test model.
   */
-class NCIntentDslSpecModel2 extends NCModelAdapter(
+class NCIdlSpecModel2 extends NCModelAdapter(
     "nlpcraft.intents.dsl.test", "IDL Test Model", "1.0"
 ) {
     override def getElements: util.Set[NCElement] = Set(NCTestElement("a"))
@@ -50,8 +50,8 @@ class NCIntentDslSpecModel2 extends NCModelAdapter(
 /**
   * IDL test.
   */
-@NCTestEnvironment(model = classOf[NCIntentDslSpecModel2], startClient = true)
-class NCIntentDslSpec2 extends NCTestContext {
+@NCTestEnvironment(model = classOf[NCIdlSpecModel2], startClient = true)
+class NCIdlSpec2 extends NCTestContext {
     @Test
     def test(): Unit = {
         checkIntent("a", "a_11")
diff --git a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/dsl/NCIntentDslTestModel.scala b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/NCIdlTestModel.scala
similarity index 84%
rename from nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/dsl/NCIntentDslTestModel.scala
rename to nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/NCIdlTestModel.scala
index 9fc4357..f6d3a88 100644
--- a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/dsl/NCIntentDslTestModel.scala
+++ b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/NCIdlTestModel.scala
@@ -15,14 +15,14 @@
  * limitations under the License.
  */
 
-package org.apache.nlpcraft.model.intent.dsl
+package org.apache.nlpcraft.model.intent.idl
 
 import org.apache.nlpcraft.model._
 
 /**
  * Test model for IDL.
  */
-class NCIntentDslTestModel extends NCModelFileAdapter("src/test/scala/org/apache/nlpcraft/model/intent/dsl/dsl_test_model.yaml") {
+class NCIdlTestModel extends NCModelFileAdapter("src/test/scala/org/apache/nlpcraft/model/intent/idl/idl_test_model.yaml") {
     @NCIntentRef("i1")
     private def callback$i1(ctx: NCIntentMatch): NCResult = NCResult.text("callback$i1")
 }
diff --git a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/dsl/NCIntentDslTestSpec.scala b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/NCIdlTestSpec.scala
similarity index 87%
rename from nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/dsl/NCIntentDslTestSpec.scala
rename to nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/NCIdlTestSpec.scala
index 3e16e3c..424da4a 100644
--- a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/dsl/NCIntentDslTestSpec.scala
+++ b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/NCIdlTestSpec.scala
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.nlpcraft.model.intent.dsl
+package org.apache.nlpcraft.model.intent.idl
 
 import org.apache.nlpcraft.common.NCException
 import org.apache.nlpcraft.model.tools.embedded.NCEmbeddedProbe
@@ -29,15 +29,15 @@ import java.util.Collections
 /**
  * IDL test model test. Make sure to start up the NLPCraft server before running this test.
  */
-class NCIntentDslTestSpec {
+class NCIdlTestSpec {
     private var cli: NCTestClient = _
 
     @BeforeEach
     @throws[NCException]
     @throws[IOException]
-    private[dsl] def setUp(): Unit = {
+    private[idl] def setUp(): Unit = {
         // Start embedded probe with the test model.
-        if (NCEmbeddedProbe.start(null, Collections.singletonList(classOf[NCIntentDslTestModel].getName))) {
+        if (NCEmbeddedProbe.start(null, Collections.singletonList(classOf[NCIdlTestModel].getName))) {
             cli = new NCTestClientBuilder().newBuilder.build
 
             cli.open("nlpcraft.dsl.test")
@@ -47,7 +47,7 @@ class NCIntentDslTestSpec {
     @AfterEach
     @throws[NCException]
     @throws[IOException]
-    private[dsl] def tearDown(): Unit = {
+    private[idl] def tearDown(): Unit = {
         if (cli != null)
             cli.close()
 
@@ -57,5 +57,5 @@ class NCIntentDslTestSpec {
     @Test
     @throws[NCException]
     @throws[IOException]
-    private[dsl] def test(): Unit = assertTrue(cli.ask("aa").isOk)
+    private[idl] def test(): Unit = assertTrue(cli.ask("aa").isOk)
 }
\ No newline at end of file
diff --git a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/dsl/compiler/NCIdlCompilerSpec.scala b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/compiler/NCIdlCompilerSpec.scala
similarity index 96%
rename from nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/dsl/compiler/NCIdlCompilerSpec.scala
rename to nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/compiler/NCIdlCompilerSpec.scala
index e6f8fcc..b627609 100644
--- a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/dsl/compiler/NCIdlCompilerSpec.scala
+++ b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/compiler/NCIdlCompilerSpec.scala
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.nlpcraft.model.intent.dsl.compiler
+package org.apache.nlpcraft.model.intent.idl.compiler
 
 import org.apache.nlpcraft.common._
 import org.apache.nlpcraft.model.NCModel
@@ -28,7 +28,7 @@ import org.junit.jupiter.api.Test
 class NCIdlCompilerSpec {
     private final val MODEL_ID = "test.mdl.id"
 
-    private final val MODEL = new NCModel {
+    private final val MODEL: NCModel = new NCModel {
         override val getId: String = MODEL_ID
         override val getName: String = MODEL_ID
         override val getVersion: String = "1.0.0"
@@ -67,7 +67,12 @@ class NCIdlCompilerSpec {
     @throws[NCException]
     def testInlineCompileOk(): Unit = {
         NCIdlCompilerGlobal.clearCache(MODEL_ID)
-        
+    
+        checkCompileOk(
+            """
+              |import('org/apache/nlpcraft/model/intent/idl/compiler/test_ok.idl')
+              |""".stripMargin
+        )
         checkCompileOk(
             """
               |intent=i1
diff --git a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/dsl/compiler/test_ok.idl b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/compiler/test_ok.idl
similarity index 96%
rename from nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/dsl/compiler/test_ok.idl
rename to nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/compiler/test_ok.idl
index 0d5214d..27252e0 100644
--- a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/dsl/compiler/test_ok.idl
+++ b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/compiler/test_ok.idl
@@ -22,6 +22,7 @@
 // Re-usable predicate #1.
 fragment=p1
     term={id(find_part(token(), "alias")) == 2}
+    term(userDefined)=/org.apache.MyShit#myMethod/
 
 // Intent #1.
 intent=i1
diff --git a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/dsl/dsl_test_model.yaml b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/idl_test_model.yaml
similarity index 100%
rename from nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/dsl/dsl_test_model.yaml
rename to nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/idl_test_model.yaml