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-website.git
The following commit(s) were added to refs/heads/master by this push:
new 001e7eb WIP on NLPCRAFT-389.
001e7eb is described below
commit 001e7ebcb1cee8db29b2fd741ac8eee0918a2bf7
Author: Aaron Radzinzski <[email protected]>
AuthorDate: Sun Aug 1 22:53:41 2021 -0700
WIP on NLPCRAFT-389.
---
_data/idl-fns.yml | 115 +++++++++++++++++++++++++++++++++++++++++++++++++++
intent-matching.html | 12 +++---
2 files changed, 121 insertions(+), 6 deletions(-)
diff --git a/_data/idl-fns.yml b/_data/idl-fns.yml
index d53abe0..cbf6aef 100644
--- a/_data/idl-fns.yml
+++ b/_data/idl-fns.yml
@@ -314,6 +314,7 @@ fn-token:
desc: |
Gets <a class="not-code" target="javadoc"
href="/apis/latest/org/apache/nlpcraft/model/NCToken.html#getEndCharIndex()">end
character index</a>
of the current token (default) or the provided one by the optional
paremeter <code><b>t</b></code> in the original text.
+ If <code>t</code> is not provided the current token is assumed.
usage: |
// Result: end character index of this token in the original text.
tok_end_idx()
@@ -377,7 +378,121 @@ fn-token:
@parts = tok_find_parts(@this, 'alias')
@tok = if(is_empty(@parts), @this, first(@parts))
+ - name: tok_index
+ sig: |
+ <b>tok_index</b>(t: Token<em><sub>opt</sub></em>) ⇒ Long
+ synopsis: Returns token's index in the original user input
+ desc: |
+ Returns <a class="not-code" target="javadoc"
href="/apis/latest/org/apache/nlpcraft/model/NCToken.html#getIndex()">token's
index</a> in the original user input. Note that this is an index of the token
and not of the character.
+ If <code>t</code> is not provided the current token is assumed.
+ usage: |
+ // Result: 'true' if index of this token in the original input is equal
to 1.
+ tok_index() == 1
+ tok_index(tok_this()) == 1
+
+ - name: tok_is_first
+ sig: |
+ <b>tok_is_first</b>(t: Token<em><sub>opt</sub></em>) ⇒ Boolean
+ synopsis: Returns <code>true</code> if this token is the first in the
original input
+ desc: |
+ Returns <code>true</code> if this token is the first in the original
input. Note that this checks index of the token and not of the character.
+ If <code>t</code> is not provided the current token is assumed.
+ usage: |
+ // Result: 'true' if this token is the first token in the original input.
+ tok_is_first()
+ tok_is_first(tok_this())
+
+ - name: tok_is_last
+ sig: |
+ <b>tok_is_last</b>(t: Token<em><sub>opt</sub></em>) ⇒ Boolean
+ synopsis: Returns <code>true</code> if this token is the last in the
original input
+ desc: |
+ Returns <code>true</code> if this token is the last in the original
input. Note that this checks index of the token and not of the character.
+ If <code>t</code> is not provided the current token is assumed
+ usage: |
+ // Result: 'true' if this token is the last token in the original input.
+ tok_is_last()
+ tok_is_last(tok_this())
+
+ - name: tok_is_before_id
+ sig: |
+ <b>tok_is_before_id</b>(id: String) ⇒ Boolean
+ synopsis: Returns <code>true</code> if there is a token with ID
<code>id</code> after this token
+ desc: |
+ Returns <code>true</code> if there is a token with ID <code>id</code>
after this token.
+ usage: |
+ // Result: 'true' if there is a token with ID 'a' after this token.
+ tok_is_before_id('a')
+
+ - name: tok_is_after_id
+ sig: |
+ <b>tok_is_after_id</b>(id: String) ⇒ Boolean
+ synopsis: Returns <code>true</code> if there is a token with ID
<code>id</code> before this token
+ desc: |
+ Returns <code>true</code> if there is a token with ID <code>id</code>
before this token.
+ usage: |
+ // Result: 'true' if there is a token with ID 'a' before this token.
+ tok_is_after_id('a')
+ - name: tok_is_before_group
+ sig: |
+ <b>tok_is_before_group</b>(grp: String) ⇒ Boolean
+ synopsis: |
+ Returns <code>true</code> if there is a token that belongs to the
+ <a class="not-code" target="javadoc"
href="/apis/latest/org/apache/nlpcraft/model/NCToken.html#getGroups()">group</a>
+ <code>grp</code> after this token
+ desc: |
+ Returns <code>true</code> if there is a token that belongs to the
+ <a class="not-code" target="javadoc"
href="/apis/latest/org/apache/nlpcraft/model/NCToken.html#getGroups()">group</a>
+ <code>grp</code> after this token.
+ usage: |
+ // Result: 'true' if there is a token that belongs to the group 'grp'
after this token.
+ tok_is_before_group('grp')
+
+ - name: tok_is_after_group
+ sig: |
+ <b>tok_is_after_group</b>(grp: String) ⇒ Boolean
+ synopsis: |
+ Returns <code>true</code> if there is a token that belongs to the
+ <a class="not-code" target="javadoc"
href="/apis/latest/org/apache/nlpcraft/model/NCToken.html#getGroups()">group</a>
+ <code>grp</code> before this token
+ desc: |
+ Returns <code>true</code> if there is a token that belongs to the
+ <a class="not-code" target="javadoc"
href="/apis/latest/org/apache/nlpcraft/model/NCToken.html#getGroups()">group</a>
+ <code>grp</code> before this token.
+ usage: |
+ // Result: 'true' if there is a token that belongs to the group 'grp'
before this token.
+ tok_is_after_group('grp')
+
+ - name: tok_is_after_parent
+ sig: |
+ <b>tok_is_after_parent</b>(parentId: String) ⇒ Boolean
+ synopsis: |
+ Returns <code>true</code> if there is a token with
+ <a class="not-code" target="javadoc"
href="/apis/latest/org/apache/nlpcraft/model/NCToken.html#getParentId()">parent
ID</a>
+ <code>parentId</code> before this token
+ desc: |
+ Returns <code>true</code> if there is a token with
+ <a class="not-code" target="javadoc"
href="/apis/latest/org/apache/nlpcraft/model/NCToken.html#getParentId()">parent
ID</a>
+ <code>parentId</code> before this token.
+ usage: |
+ // Result: 'true' if there is a token with parent ID 'owner' before this
token.
+ tok_is_after_parent('owner')
+
+ - name: tok_is_before_parent
+ sig: |
+ <b>tok_is_before_parent</b>(parentId: String) ⇒ Boolean
+ synopsis: |
+ Returns <code>true</code> if there is a token with
+ <a class="not-code" target="javadoc"
href="/apis/latest/org/apache/nlpcraft/model/NCToken.html#getParentId()">parent
ID</a>
+ <code>parentId</code> after this token
+ desc: |
+ Returns <code>true</code> if there is a token with
+ <a class="not-code" target="javadoc"
href="/apis/latest/org/apache/nlpcraft/model/NCToken.html#getParentId()">parent
ID</a>
+ <code>parentId</code> after this token.
+ usage: |
+ // Result: 'true' if there is a token with parent ID 'owner' after this
token.
+ tok_is_before_parent('owner')
fn-datetime:
- name: year
diff --git a/intent-matching.html b/intent-matching.html
index f39d14d..78823d9 100644
--- a/intent-matching.html
+++ b/intent-matching.html
@@ -41,7 +41,7 @@ id: intent_matching
The intent has a <em>declarative part or template</em> written in
<a href="#idl">Intent Definition Language</a> that strictly defines
a particular form the user input.
Intent is also <a href="#binding">bound</a> to a callback method
that will be executed when that intent, i.e. its template, is detected as the
best match
- for a given input input. A typical data model will have multiple
intents defined for each form of the expected user input
+ for a given input. A typical data model will have multiple intents
defined for each form of the expected user input
that model wants to react to.
</p>
<p>
@@ -1011,8 +1011,8 @@ id: intent_matching
takes a string as its parameter that should be a valid IDL
declaration. For example, Scala code snippet:
</p>
<pre class="brush: scala, highlight: [1, 2]">
- @NCIntent("import('/opt/myproj/global_fragments.idl')")
- @NCIntent("intent=act term(act)={has(tok_groups(), 'act')}
fragment(f1)")
+ @NCIntent("import('/opt/myproj/global_fragments.idl')") //
Importing.
+ @NCIntent("intent=act term(act)={has(tok_groups(), 'act')}
fragment(f1)") // Defining in place.
def onMatch(
@NCIntentTerm("act") actTok: NCToken,
@NCIntentTerm("loc") locToks: List[NCToken]
@@ -1035,9 +1035,9 @@ id: intent_matching
.
.
"intents": [
- "import('/opt/myproj/global_fragments.idl')",
- "import('/opt/myproj/my_intents.idl')",
- "intent=alarm term~{tok_id()=='x:alarm'}"
+ "import('/opt/myproj/global_fragments.idl')", //
Importing.
+ "import('/opt/myproj/my_intents.idl')", // Importing.
+ "intent=alarm term~{tok_id()=='x:alarm'}" // Defining
in place.
]
}
</pre>