This is an automated email from the ASF dual-hosted git repository. aradzinski pushed a commit to branch NLPCRAFT-278 in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
commit 4265ffc70d259943a9f42788081da21ab91b485d Author: Aaron Radzinski <[email protected]> AuthorDate: Tue Mar 23 19:14:44 2021 -0700 WIP. --- README.md | 2 +- .../src/main/scala/org/apache/nlpcraft/examples/sql/SqlModel.scala | 2 +- .../src/main/scala/org/apache/nlpcraft/examples/sql/sql_model.yaml | 4 ++-- .../src/main/scala/org/apache/nlpcraft/model/NCIntentSample.java | 2 +- .../nlpcraft/model/intent/idl/compiler/NCIdlCompilerSpec.scala | 6 +++--- .../scala/org/apache/nlpcraft/model/intent/idl/compiler/test_ok.idl | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 5658c7f..e7a522e 100644 --- a/README.md +++ b/README.md @@ -152,7 +152,7 @@ elements: - "{<ACTION>|shut|kill|stop|eliminate} {off|out} <LIGHT>" - "no <LIGHT>" intents: - - "intent=ls term(act)~{has(groups(), 'act')} term(loc)~{id() == 'ls:loc'}*" + - "intent=ls term(act)~{has(tok_groups(), 'act')} term(loc)~{tok_id() == 'ls:loc'}*" ``` ### Model Implementation diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/sql/SqlModel.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/sql/SqlModel.scala index d1ec30b..820c4ad 100644 --- a/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/sql/SqlModel.scala +++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/sql/SqlModel.scala @@ -278,7 +278,7 @@ class SqlModel extends NCModelFileAdapter("org/apache/nlpcraft/examples/sql/sql_ */ @NCIntent( "intent=commonReport " + - "term(tbls)~{has(groups(), 'table')}[0,7] " + + "term(tbls)~{has(tok_groups(), 'table')}[0,7] " + "term(cols)~{has(list('col:date', 'col:num', 'col:varchar'), tok_id())}[0,7] " + "term(condNums)~{tok_id() == 'condition:num'}[0,7] " + "term(condVals)~{tok_id() == 'condition:value'}[0,7] " + diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/sql/sql_model.yaml b/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/sql/sql_model.yaml index 88df041..856e1ae 100644 --- a/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/sql/sql_model.yaml +++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/sql/sql_model.yaml @@ -1445,12 +1445,12 @@ elements: groups: - "element" synonyms: - - "^^[colName]{has(groups(), 'column') && value() == null}^^" + - "^^[colName]{has(tok_groups(), 'column') && tok_value() == null}^^" - id: "col:val" groups: - "element" synonyms: - - "^^[colVal]{has(groups(), 'column') && value() != null}^^" + - "^^[colVal]{has(tok_groups(), 'column') && tok_value() != null}^^" - id: "col:num" groups: - "element" 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 7a97a01..75cd1e0 100644 --- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCIntentSample.java +++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCIntentSample.java @@ -35,7 +35,7 @@ import static java.lang.annotation.RetentionPolicy.*; * <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(groups(), 'act')} term(loc)={trim(id()) == 'ls:loc'}*") + * {@literal @}NCIntent("intent=act term(act)={has(tok_groups(), 'act')} term(loc)={trim(tok_id()) == '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/NCIdlCompilerSpec.scala b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/compiler/NCIdlCompilerSpec.scala index fd6e8e5..0f09a66 100644 --- a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/compiler/NCIdlCompilerSpec.scala +++ b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/compiler/NCIdlCompilerSpec.scala @@ -79,7 +79,7 @@ class NCIdlCompilerSpec { |intent=i1 | flow="a[^0-9]b" | meta={'a': true, 'b': {'Москва': [1, 2, 3]}} - | term(t1)={2 == 2 && size(id()) != -25} + | term(t1)={2 == 2 && size(tok_id()) != -25} |""".stripMargin ) checkCompileOk( @@ -140,7 +140,7 @@ class NCIdlCompilerSpec { | */ | flow="a[^0-9]b" | meta={{'a': true, 'b': {'arr': [1, 2, 3]}} - | term(t1)={2 == 2 && size(id()) != -25} + | term(t1)={2 == 2 && size(tok_id()) != -25} |""".stripMargin ) checkCompileError( @@ -148,7 +148,7 @@ class NCIdlCompilerSpec { |intent=i1 | meta={'a': true, 'b': {'arr': [1, 2, 3]}} | term(t1)={ - | @x == 2 && size(id()) != -25 + | @x == 2 && size(tok_id()) != -25 | } |""".stripMargin ) 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 4ca2b8c..b9ae2df 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 @@ -21,7 +21,7 @@ // Re-usable predicate #1. fragment=p1 - term={id(tok_find_part(token(), "alias")) == 2} + term={tok_id(tok_find_part(tok_this(), "alias")) == 2} term={meta_frag('a') && has_any(get(meta_frag('b'), 'Москва'), list(1, 2))} term(userDefined)=/org.apache.MyShit#myMethod/ @@ -37,7 +37,7 @@ intent=i1 intent=i2 flow="a[^0-9]b" meta={'a': 42, 'b': {'Москва': [1, 2, 3]}} - term(t1)={2 == 2 && !(id()) != -25 && meta_model('a') == 42} + term(t1)={2 == 2 && !(tok_id()) != -25 && meta_model('a') == 42} term(t2)={ @a = meta_model('a') @list = list(1, 2, 3, 4)
