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

aradzinski 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 8f9d7c5  WIP.
8f9d7c5 is described below

commit 8f9d7c53bff9bb804e92bc8834f8b0f49afdef7a
Author: Aaron Radzinski <[email protected]>
AuthorDate: Sun Mar 7 13:15:01 2021 -0800

    WIP.
---
 .../nlpcraft/model/intent/impl/NCIntentDslBaselCompiler.scala      | 7 +++++--
 .../apache/nlpcraft/model/intent/impl/NCIntentDslCompiler.scala    | 2 +-
 .../apache/nlpcraft/model/intent/impl/NCIntentSolverEngine.scala   | 2 +-
 .../dsl/{NCIntentDslSpec.scala => NCIntentDslTestSpec.scala}       | 2 +-
 .../model/intent/dsl/{ => compiler}/NCIntentDslCompilerSpec.scala  | 4 ++--
 .../org/apache/nlpcraft/model/intent/dsl/{ => compiler}/test_ok.nc | 0
 .../scala/org/apache/nlpcraft/model/intent/dsl/dsl_test_model.yaml | 4 ++--
 7 files changed, 12 insertions(+), 9 deletions(-)

diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/NCIntentDslBaselCompiler.scala
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/NCIntentDslBaselCompiler.scala
index 65cbabb..0ab72ba 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/NCIntentDslBaselCompiler.scala
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/NCIntentDslBaselCompiler.scala
@@ -60,10 +60,13 @@ trait NCIntentDslBaselCompiler {
     type StackType = mutable.ArrayStack[NCDslTermRetVal]
     type Instr = (NCToken, StackType,  NCDslTermContext) ⇒ Unit
 
+    //noinspection ComparingUnrelatedTypes
     def isJLong(v: Object): Boolean = v.isInstanceOf[JLong]
+    //noinspection ComparingUnrelatedTypes
     def isJDouble(v: Object): Boolean = v.isInstanceOf[JDouble]
-    def isString(v: Object): Boolean = v.isInstanceOf[String]
+    //noinspection ComparingUnrelatedTypes
     def isBoolean(v: Object): Boolean = v.isInstanceOf[Boolean]
+    def isString(v: Object): Boolean = v.isInstanceOf[String]
     def asJLong(v: Object): Long = v.asInstanceOf[JLong].longValue()
     def asJDouble(v: Object): Double = v.asInstanceOf[JDouble].doubleValue()
     def asString(v: Object): String = v.asInstanceOf[String]
@@ -462,7 +465,7 @@ trait NCIntentDslBaselCompiler {
             var f = false
 
             stack.drain { x ⇒
-                jl.add(x.retVal.asInstanceOf[Object])
+                jl.add(x.retVal)
                 f = f || x.usedTok
             }
 
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/NCIntentDslCompiler.scala
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/NCIntentDslCompiler.scala
index 59b85da..53a1eb0 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/NCIntentDslCompiler.scala
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/NCIntentDslCompiler.scala
@@ -208,7 +208,7 @@ object NCIntentDslCompiler extends LazyLogging {
                             override lazy val getToken: NCToken = tok
                             override lazy val getIntentMeta: 
Optional[NCMetadata] =
                                 if (termCtx.intentMeta != null)
-                                    
Optional.of(NCMetadata.apply(termCtx.intentMeta.asJava.asInstanceOf[java.util.Map[String,
 Object]]))
+                                    
Optional.of(NCMetadata.apply(termCtx.intentMeta.asJava))
                                 else
                                     Optional.empty()
                         }
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/NCIntentSolverEngine.scala
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/NCIntentSolverEngine.scala
index 8b2b7c1..72f5e4c 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/NCIntentSolverEngine.scala
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/impl/NCIntentSolverEngine.scala
@@ -483,7 +483,7 @@ object NCIntentSolverEngine extends LazyLogging with 
NCOpenCensusTrace {
             val ordered = intent.ordered
             var lastTermMatch: TermMatch = null
             
-            val termCtx = NCDslTermContext( // TODO
+            val termCtx = NCDslTermContext(
                 intentMeta = intent.meta,
                 reqMeta = ctx.getRequest.getRequestData,
                 usrMeta = ctx.getRequest.getUser.getMetadata,
diff --git 
a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/dsl/NCIntentDslSpec.scala
 
b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/dsl/NCIntentDslTestSpec.scala
similarity index 98%
rename from 
nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/dsl/NCIntentDslSpec.scala
rename to 
nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/dsl/NCIntentDslTestSpec.scala
index f8ed762..fd8d4b3 100644
--- 
a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/dsl/NCIntentDslSpec.scala
+++ 
b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/dsl/NCIntentDslTestSpec.scala
@@ -29,7 +29,7 @@ import java.util.Collections
 /**
  * DSL test model test. Make sure to start up the NLPCraft server before 
running this test.
  */
-class NCIntentDslSpec {
+class NCIntentDslTestSpec {
     private var cli: NCTestClient = _
 
     @BeforeEach
diff --git 
a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/dsl/NCIntentDslCompilerSpec.scala
 
b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/dsl/compiler/NCIntentDslCompilerSpec.scala
similarity index 98%
rename from 
nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/dsl/NCIntentDslCompilerSpec.scala
rename to 
nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/dsl/compiler/NCIntentDslCompilerSpec.scala
index ac54ccd..63d3e68 100644
--- 
a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/dsl/NCIntentDslCompilerSpec.scala
+++ 
b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/dsl/compiler/NCIntentDslCompilerSpec.scala
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.nlpcraft.model.intent.dsl
+package org.apache.nlpcraft.model.intent.dsl.compiler
 
 import org.apache.nlpcraft.common._
 import org.apache.nlpcraft.model.intent.impl.{NCIntentDslCompiler, 
NCIntentDslFragmentCache}
@@ -124,7 +124,7 @@ class NCIntentDslCompilerSpec {
               |     term~/class#method/
               |
               |fragment=f22
-              |     term(f22_t1)={2==2}
+              |     term(f22_t1)={2==2_000_000.23}
               |     fragment(f21)
               |     term~/class#method/
               |
diff --git 
a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/dsl/test_ok.nc 
b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/dsl/compiler/test_ok.nc
similarity index 100%
rename from 
nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/dsl/test_ok.nc
rename to 
nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/dsl/compiler/test_ok.nc
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/dsl/dsl_test_model.yaml
index ae76150..219f27e 100644
--- 
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/dsl/dsl_test_model.yaml
@@ -46,10 +46,10 @@ elements:
       floatVal: 3.5
       textVal: "a3"
     synonyms:
-    - "^^id == 'nlpcraft:num'^^ ^^[alias2](trim(id) == ('a2', 'x', 'y'))^^ 
^^[alias3](id == 'a')^^"
+    - "{a33|a3}"
   - id: "a4"
     synonyms:
       - "{fourth|4th} ^^[alias4](id == 'a3')^^"
 
 intents:
-  - "intent=i1 term(t1)={id == 'a' && ~txt == 'x'}"
+  - "intent=i1 term(t1)={id() == 'a' && meta_token('txt') == 'x'}"

Reply via email to