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

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


The following commit(s) were added to refs/heads/NLPCRAFT-426 by this push:
     new bb8c5d8  WIP
bb8c5d8 is described below

commit bb8c5d844945a541656bd971d1ff3f9fb8d7fae0
Author: Aaron Radzinski <[email protected]>
AuthorDate: Tue Aug 24 15:52:28 2021 -0700

    WIP
---
 README.md                                          |  2 +-
 .../alarm/src/main/resources/intents.idl           |  4 +--
 .../src/main/resources/lightswitch_model.yaml      |  2 +-
 .../minecraft/src/main/resources/minecraft.yaml    | 34 +++++++++++-----------
 .../apache/nlpcraft/examples/phone/PhoneModel.java |  4 +--
 .../sql/src/main/resources/sql_model.yaml          | 18 ++++++------
 .../apache/nlpcraft/examples/time/TimeModel.java   |  6 ++--
 .../nlpcraft/examples/weather/WeatherModel.java    |  8 ++---
 .../scala/org/apache/nlpcraft/model/NCIntent.java  |  2 +-
 .../org/apache/nlpcraft/model/NCIntentSample.java  |  2 +-
 .../org/apache/nlpcraft/model/NCIntentTerm.java    |  2 +-
 .../nlpcraft/model/intent/idl/compiler/test_ok.idl |  4 +--
 .../nlpcraft/model/intent/idl/idl_test_model.yaml  |  6 ++--
 .../probe/mgrs/deploy/javatest/NCNestedClass.java  |  2 +-
 .../probe/mgrs/deploy/javatest/NCNestedStatic.java |  2 +-
 15 files changed, 49 insertions(+), 49 deletions(-)

diff --git a/README.md b/README.md
index 5f16bef..b85a766 100644
--- a/README.md
+++ b/README.md
@@ -171,7 +171,7 @@ elements:
     - "no <LIGHT>"
 
 intents:
- - "intent=ls term(act)={has(tok_groups(), 'act')} term(loc)={tok_id() == 
'ls:loc'}*"
+ - "intent=ls term(act)={has(tok_groups, 'act')} term(loc)={# == 'ls:loc'}*"
 ```
 
 ### Model Implementation
diff --git a/nlpcraft-examples/alarm/src/main/resources/intents.idl 
b/nlpcraft-examples/alarm/src/main/resources/intents.idl
index 3c1810b..3c3934d 100644
--- a/nlpcraft-examples/alarm/src/main/resources/intents.idl
+++ b/nlpcraft-examples/alarm/src/main/resources/intents.idl
@@ -16,14 +16,14 @@
  */
 
 // Fragments (mostly for demo purposes here).
-fragment=buzz term~{tok_id() == 'x:alarm'}
+fragment=buzz term~{# == 'x:alarm'}
 fragment=when
     term(nums)~{
         // Demonstrating term variables.
         @type = meta_tok('nlpcraft:num:unittype')
         @iseq = meta_tok('nlpcraft:num:isequalcondition') // Excludes 
conditional statements.
 
-        tok_id() == 'nlpcraft:num' && @type == 'datetime' && @iseq == true
+        # == 'nlpcraft:num' && @type == 'datetime' && @iseq == true
     }[1,7]
 
 // Intents (using fragments).
diff --git 
a/nlpcraft-examples/lightswitch/src/main/resources/lightswitch_model.yaml 
b/nlpcraft-examples/lightswitch/src/main/resources/lightswitch_model.yaml
index c79329a..a976f64 100644
--- a/nlpcraft-examples/lightswitch/src/main/resources/lightswitch_model.yaml
+++ b/nlpcraft-examples/lightswitch/src/main/resources/lightswitch_model.yaml
@@ -72,4 +72,4 @@ elements:
       - "<LIGHT> {out|off|down}"
 
 intents:
-  - "intent=ls term(act)={has(tok_groups(), 'act')} term(loc)={tok_id() == 
'ls:loc'}*"
\ No newline at end of file
+  - "intent=ls term(act)={has(tok_groups, 'act')} term(loc)={# == 'ls:loc'}*"
\ No newline at end of file
diff --git a/nlpcraft-examples/minecraft/src/main/resources/minecraft.yaml 
b/nlpcraft-examples/minecraft/src/main/resources/minecraft.yaml
index b1229a1..9cffd47 100644
--- a/nlpcraft-examples/minecraft/src/main/resources/minecraft.yaml
+++ b/nlpcraft-examples/minecraft/src/main/resources/minecraft.yaml
@@ -100,7 +100,7 @@ elements:
   # Give intent
   - id: give:action
     synonyms:
-      - "{give ^^[target]{tok_id() == 'mc:player'}^^}"
+      - "{give ^^[target]{# == 'mc:player'}^^}"
   - id: give:block-word
     synonyms:
       - "{block|blocks}"
@@ -124,18 +124,18 @@ elements:
       - "wall"
   - id: fill:length
     synonyms:
-      - "{{size|length|diameter} {of|_} ^^[length]{tok_id() == 
'nlpcraft:num'}^^}"
+      - "{{size|length|diameter} {of|_} ^^[length]{# == 'nlpcraft:num'}^^}"
   - id: position:player
     groups:
       - fill:position
     synonyms:
-      - "{{at|near} ^^[player]{tok_id() == 'mc:player'}^^ {position|_}|where 
^^[player]{tok_id() == 'mc:player'}^^}"
+      - "{{at|near} ^^[player]{# == 'mc:player'}^^ {position|_}|where 
^^[player]{# == 'mc:player'}^^}"
 
   - id: position:front
     groups:
       - fill:position
     synonyms:
-      - "{{^^[distance]{tok_id() == 'nlpcraft:num'}^^|_} {in|_} front {of|_} 
^^[player]{tok_id() == 'mc:player'}^^}"
+      - "{{^^[distance]{# == 'nlpcraft:num'}^^|_} {in|_} front {of|_} 
^^[player]{# == 'mc:player'}^^}"
 
 abstractTokens:
    - mc:player
@@ -152,22 +152,22 @@ sparse: true
 # List of model intents.
 intents:
   - "intent=weatherIntent
-        term={tok_id() == 'weather:action'}?
-        term(arg)={has(tok_groups(), 'weather')}"
+        term={# == 'weather:action'}?
+        term(arg)={has(tok_groups, 'weather')}"
 
   - "intent=timeIntent
-        term={tok_id() == 'time:action'}?
-        term(arg)={has(tok_groups(), 'time')}"
+        term={# == 'time:action'}?
+        term(arg)={has(tok_groups, 'time')}"
 
   - "intent=giveIntent
-        term(action)={tok_id() == 'give:action'}
-        term(quantity)={tok_id() == 'nlpcraft:num'}?
-        term(item)={tok_id() == 'mc:item'}
-        term={tok_id() == 'give:block-word'}?"
+        term(action)={# == 'give:action'}
+        term(quantity)={# == 'nlpcraft:num'}?
+        term(item)={# == 'mc:item'}
+        term={# == 'give:block-word'}?"
 
   - "intent=fillIntent
-        term={tok_id() == 'fill:action'}
-        term(shape)={has(tok_groups(), 'fill:shape')}
-        term(block)={tok_id() == 'mc:block'}
-        term(len)={tok_id() == 'fill:length'}?
-        term(position)={has(tok_groups(), 'fill:position')}"
\ No newline at end of file
+        term={# == 'fill:action'}
+        term(shape)={has(tok_groups, 'fill:shape')}
+        term(block)={# == 'mc:block'}
+        term(len)={# == 'fill:length'}?
+        term(position)={has(tok_groups, 'fill:position')}"
\ No newline at end of file
diff --git 
a/nlpcraft-examples/phone/src/main/java/org/apache/nlpcraft/examples/phone/PhoneModel.java
 
b/nlpcraft-examples/phone/src/main/java/org/apache/nlpcraft/examples/phone/PhoneModel.java
index 20ce259..5ad2503 100644
--- 
a/nlpcraft-examples/phone/src/main/java/org/apache/nlpcraft/examples/phone/PhoneModel.java
+++ 
b/nlpcraft-examples/phone/src/main/java/org/apache/nlpcraft/examples/phone/PhoneModel.java
@@ -55,9 +55,9 @@ public class PhoneModel extends NCModelFileAdapter {
      */
     @NCIntent("" +
         "intent=action " +
-        "term={tok_id() == 'phone:act'} " +
+        "term={# == 'phone:act'} " +
         // Either organization, person or a phone number (or a combination of).
-        "term(rcpt)={has(list('google:organization', 'google:person', 
'google:phone_number'), tok_id())}[1,3]"
+        "term(rcpt)={has(list('google:organization', 'google:person', 
'google:phone_number'), #)}[1,3]"
     )
     @NCIntentSample({
         "Call to Apple office",
diff --git a/nlpcraft-examples/sql/src/main/resources/sql_model.yaml 
b/nlpcraft-examples/sql/src/main/resources/sql_model.yaml
index 1cd55e1..037a800 100644
--- a/nlpcraft-examples/sql/src/main/resources/sql_model.yaml
+++ b/nlpcraft-examples/sql/src/main/resources/sql_model.yaml
@@ -1445,43 +1445,43 @@ elements:
   groups:
     - "element"
   synonyms:
-    - "^^[colName]{has(tok_groups(), 'column') && tok_value() == null}^^"
+    - "^^[colName]{has(tok_groups, 'column') && tok_value == null}^^"
 - id: "col:val"
   groups:
     - "element"
   synonyms:
-    - "^^[colVal]{has(tok_groups(), 'column') && tok_value() != null}^^"
+    - "^^[colVal]{has(tok_groups, 'column') && tok_value != null}^^"
 - id: "col:num"
   groups:
     - "element"
   synonyms:
-    - "^^{tok_id() == 'col' && has(list(4, 8), meta_part('colName', 
'sql:datatype'))}^^"
+    - "^^{# == 'col' && has(list(4, 8), meta_part('colName', 
'sql:datatype'))}^^"
 - id: "col:date"
   groups:
     - "element"
   synonyms:
-    - "^^{tok_id() == 'col' && meta_part('colName', 'sql:datatype') == 91}^^"
+    - "^^{# == 'col' && meta_part('colName', 'sql:datatype') == 91}^^"
 - id: "col:varchar"
   groups:
     - "element"
   synonyms:
-    - "^^{tok_id() == 'col' && meta_part('colName', 'sql:datatype') == 12}^^"
+    - "^^{# == 'col' && meta_part('colName', 'sql:datatype') == 12}^^"
 - id: "condition:num"
   groups:
     - "condition"
   synonyms:
-    - "^^{tok_id() == 'col:num'}^^ ^^{tok_id() == 'nlpcraft:num'}^^ "
+    - "^^{# == 'col:num'}^^ ^^{# == 'nlpcraft:num'}^^ "
 - id: "condition:value"
   groups:
     - "condition"
   synonyms:
-    - "^^{tok_id() == 'col:varchar'}^^ {is|equal|_} ^^{tok_id() == 
'col:val'}^^"
-    - "^^{tok_id() == 'col:val'}^^"
+    - "^^{# == 'col:varchar'}^^ {is|equal|_} ^^{# == 'col:val'}^^"
+    - "^^{# == 'col:val'}^^"
 - id: "condition:date"
   groups:
     - "condition"
   synonyms:
-    - "^^{tok_id() == 'col:date'}^^ ^^{tok_id() == 'nlpcraft:date'}^^"
+    - "^^{# == 'col:date'}^^ ^^{# == 'nlpcraft:date'}^^"
 - id: "sort:best"
   groups:
     - "Sort criteria"
diff --git 
a/nlpcraft-examples/time/src/main/java/org/apache/nlpcraft/examples/time/TimeModel.java
 
b/nlpcraft-examples/time/src/main/java/org/apache/nlpcraft/examples/time/TimeModel.java
index bff4d9c..9023465 100644
--- 
a/nlpcraft-examples/time/src/main/java/org/apache/nlpcraft/examples/time/TimeModel.java
+++ 
b/nlpcraft-examples/time/src/main/java/org/apache/nlpcraft/examples/time/TimeModel.java
@@ -41,9 +41,9 @@ import static java.time.format.FormatStyle.*;
  * See 'README.md' file in the same folder for running and testing 
instructions.
  */
 // Declaring intents on the class level + fragment usage for demo purposes.
-@NCIntent("fragment=city term(city)~{tok_id() == 'nlpcraft:city'}")
-@NCIntent("intent=intent2 term~{tok_id() == 'x:time'} fragment(city)")
-@NCIntent("intent=intent1 term={tok_id() == 'x:time'}")
+@NCIntent("fragment=city term(city)~{# == 'nlpcraft:city'}")
+@NCIntent("intent=intent2 term~{# == 'x:time'} fragment(city)")
+@NCIntent("intent=intent1 term={# == 'x:time'}")
 public class TimeModel extends NCModelFileAdapter {
     // Medium data formatter.
     static private final DateTimeFormatter FMT = 
DateTimeFormatter.ofLocalizedDateTime(MEDIUM);
diff --git 
a/nlpcraft-examples/weather/src/main/java/org/apache/nlpcraft/examples/weather/WeatherModel.java
 
b/nlpcraft-examples/weather/src/main/java/org/apache/nlpcraft/examples/weather/WeatherModel.java
index f6cf737..325d428 100644
--- 
a/nlpcraft-examples/weather/src/main/java/org/apache/nlpcraft/examples/weather/WeatherModel.java
+++ 
b/nlpcraft-examples/weather/src/main/java/org/apache/nlpcraft/examples/weather/WeatherModel.java
@@ -142,13 +142,13 @@ public class WeatherModel extends NCModelFileAdapter {
      */
     @NCIntent(
         "intent=req " +
-        "term~{tok_id() == 'wt:phen'}* " + // Zero or more weather phenomenon.
+        "term~{# == 'wt:phen'}* " + // Zero or more weather phenomenon.
         "term(ind)~{" +
-            "@isIndicator = has(tok_groups(), 'indicator') " + // Just to demo 
term variable usage.
+            "@isIndicator = has(tok_groups, 'indicator') " + // Just to demo 
term variable usage.
             "@isIndicator" +
         "}* " + // Optional indicator words (zero or more).
-        "term(city)~{tok_id() == 'nlpcraft:city'}? " + // Optional city.
-        "term(date)~{tok_id() == 'nlpcraft:date'}?" // Optional date 
(overrides indicator words).
+        "term(city)~{# == 'nlpcraft:city'}? " + // Optional city.
+        "term(date)~{# == 'nlpcraft:date'}?" // Optional date (overrides 
indicator words).
     )
     // NOTE: each samples group will reset conversation STM during 
auto-testing.
     @NCIntentSample({
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCIntent.java 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCIntent.java
index 484a1d3..0639ae9 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCIntent.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCIntent.java
@@ -32,7 +32,7 @@ import static java.lang.annotation.RetentionPolicy.*;
  * Here's an example of using this annotation (from <a target=_new 
href="https://nlpcraft.apache.org/examples/light_switch.html";>LightSwitch</a> 
example):
  * <pre class="brush: java, highlight: [1,2]">
  * {@literal @}NCIntent("import('intents.idl')")
- * {@literal @}NCIntent("intent=act term(act)={has(tok_groups(), 'act')} 
term(loc)={trim(tok_id()) == 'ls:loc'}*")
+ * {@literal @}NCIntent("intent=act term(act)={has(tok_groups, 'act')} 
term(loc)={# == 'ls:loc'}*")
  * {@literal @}NCIntentSample(Array(
  *     "Turn the lights off in the entire house.",
  *     "Switch on the illumination in the master bedroom closet.",
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCIntentSample.java 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCIntentSample.java
index 6d57d0d..0a56ba9 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCIntentSample.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCIntentSample.java
@@ -54,7 +54,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
  * <p>
  * Here's an example of using this annotation (from <a target=_new 
href="https://nlpcraft.apache.org/examples/light_switch.html";>LightSwitch</a> 
example):
  * <pre class="brush: java, highlight: [2]">
- * {@literal @}NCIntent("intent=act term(act)={has(tok_groups(), 'act')} 
term(loc)={trim(tok_id()) == 'ls:loc'}*")
+ * {@literal @}NCIntent("intent=act term(act)={has(tok_groups, 'act')} 
term(loc)={# == 'ls:loc'}*")
  * {@literal @}NCIntentSample(Array(
  *     "Turn the lights off in the entire house.",
  *     "Switch on the illumination in the master bedroom closet.",
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCIntentTerm.java 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCIntentTerm.java
index 13832a0..d8302ac 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCIntentTerm.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCIntentTerm.java
@@ -36,7 +36,7 @@ import static java.lang.annotation.RetentionPolicy.*;
  * Here's an example of using this annotation (from <a target=_new 
href="https://nlpcraft.apache.org/examples/light_switch.html";>LightSwitch</a> 
example):
  * <pre class="brush: java, highlight: [10,11]">
  * {@literal @}NCIntent("import('intents.idl')")
- * {@literal @}NCIntent("intent=act term(act)={has(tok_groups(), 'act')} 
term(loc)={trim(tok_id()) == 'ls:loc'}*")
+ * {@literal @}NCIntent("intent=act term(act)={has(tok_groups, 'act')} 
term(loc)={# == 'ls:loc'}*")
  * {@literal @}NCIntentSample(Array(
  *     "Turn the lights off in the entire house.",
  *     "Switch on the illumination in the master bedroom closet.",
diff --git 
a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/compiler/test_ok.idl
 
b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/compiler/test_ok.idl
index d380eed..fdb2e83 100644
--- 
a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/compiler/test_ok.idl
+++ 
b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/compiler/test_ok.idl
@@ -37,7 +37,7 @@ intent=i1
 intent=i2
     flow="a[^0-9]b"
     meta={'a': 42, 'b': {'Москва': [1, 2, 3]}}
-    term(t1)={2 == 2 && !(tok_id()) != -25 && meta_model('a') == 42}
+    term(t1)={2 == 2 && !# != -25 && meta_model('a') == 42}
     term(t2)={
         @a = meta_model('a')
         @list = list(1, 2, 3, 4)
@@ -62,7 +62,7 @@ intent=i4 flow=/#flowModelMethod/ term(t1)=/#termModelMethod/
 intent=i5
     flow="a[^0-9]b"
     meta={'a': 42, 'b': {'Москва': [1, 2, 3]}}
-    term(t1)={month() >= 6 && !(tok_id()) != -25 && meta_model('a') == 42}
+    term(t1)={month >= 6 && !(#) != -25 && meta_model('a') == 42}
     term(t2)={
         @a = meta_model('a')
         @list = list(1, 2, 3, 4)
diff --git 
a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/idl_test_model.yaml
 
b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/idl_test_model.yaml
index a9b70f1..2837692 100644
--- 
a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/idl_test_model.yaml
+++ 
b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/idl_test_model.yaml
@@ -38,7 +38,7 @@ elements:
       floatVal: 1.5
       textVal: "a2"
     synonyms:
-    - "{second|2nd} ^^[alias1]{trim(tok_id()) == 'a'}^^"
+    - "{second|2nd} ^^[alias1]{# == 'a'}^^"
   - id: "a3"
     metadata:
       intVal: 2
@@ -49,7 +49,7 @@ elements:
     - "{a33|a3}"
   - id: "a4"
     synonyms:
-      - "{fourth|4th} ^^[alias4]{tok_id() == 'a3'}^^"
+      - "{fourth|4th} ^^[alias4]{# == 'a3'}^^"
 
 intents:
-  - "intent=i1 term(t1)={tok_id() == 'a' && meta_tok('txt') == 'x'}"
+  - "intent=i1 term(t1)={# == 'a' && meta_tok('txt') == 'x'}"
diff --git 
a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/deploy/javatest/NCNestedClass.java
 
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/deploy/javatest/NCNestedClass.java
index 131f02e..335d2f8 100644
--- 
a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/deploy/javatest/NCNestedClass.java
+++ 
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/deploy/javatest/NCNestedClass.java
@@ -24,7 +24,7 @@ import org.apache.nlpcraft.model.NCResult;
  *
  */
 public class NCNestedClass {
-    @NCIntent("intent=javaClass term={tok_id() == 'javaClass'}")
+    @NCIntent("intent=javaClass term={# == 'javaClass'}")
     public NCResult m() {
         return NCResult.text("OK");
     }
diff --git 
a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/deploy/javatest/NCNestedStatic.java
 
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/deploy/javatest/NCNestedStatic.java
index a91faa9..478452b 100644
--- 
a/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/deploy/javatest/NCNestedStatic.java
+++ 
b/nlpcraft/src/test/scala/org/apache/nlpcraft/probe/mgrs/deploy/javatest/NCNestedStatic.java
@@ -24,7 +24,7 @@ import org.apache.nlpcraft.model.NCResult;
  *
  */
 public class NCNestedStatic {
-    @NCIntent("intent=javaStatic term={tok_id() == 'javaStatic'}")
+    @NCIntent("intent=javaStatic term={# == 'javaStatic'}")
     public static NCResult m() {
         return NCResult.text("OK");
     }

Reply via email to