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/09/04 01:11:25 UTC
[incubator-nlpcraft-website] 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-website.git
The following commit(s) were added to refs/heads/master by this push:
new 3ad8056 WIP
3ad8056 is described below
commit 3ad805600d6f778feef7ac3495615f3507ebd7e0
Author: Aaron Radzinski <ar...@apache.org>
AuthorDate: Fri Sep 3 18:10:06 2021 -0700
WIP
---
_data/idl-fns.yml | 307 +++++++++++----------
blogs/nlpcraft-idl-intent-definition-language.html | 33 ++-
blogs/quick_intro_apache_nlpcraft.html | 2 +-
blogs/short_term_memory.html | 8 +-
data-model.html | 12 +-
examples/alarm_clock.html | 2 +-
examples/light_switch.html | 2 +-
first-example.html | 2 +-
intent-matching.html | 84 +++---
short-term-memory.html | 8 +-
10 files changed, 239 insertions(+), 221 deletions(-)
diff --git a/_data/idl-fns.yml b/_data/idl-fns.yml
index 3a1ae85..51f6f29 100644
--- a/_data/idl-fns.yml
+++ b/_data/idl-fns.yml
@@ -6,7 +6,7 @@
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
-# http://www.apache.org/licenses/LICENSE-2.0
+# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@@ -22,15 +22,18 @@
fn-token:
- name: tok_id
sig: |
- <b>tok_id</b>(t: Token<em><sub>opt</sub></em>) ⇒ String
+ <b>tok_id</b>(t: Token<em><sub>opt</sub></em>) ⇒ String, # ⇒ String
synopsis: Returns <a class="not-code" target="javadoc" href="/apis/latest/org/apache/nlpcraft/model/NCToken.html#getId()">token ID</a>
desc: |
Returns <a class="not-code" target="javadoc" href="/apis/latest/org/apache/nlpcraft/model/NCToken.html#getId()">token ID</a>
- for the current token (default) or the provided one by the optional paremeter <code><b>t</b></code>.
+ for the current token (default) or the provided one by the optional paremeter <code><b>t</b></code>. Note that this
+ functions has a special shorthand <code><b>#</b></code>.
usage: |
// Result: 'true' if the current token ID is equal to 'my_id'.
- tok_id() == 'my_id'
- tok_id(tok_this()) == 'my_id'
+ tok_id == 'my_id'
+ # == 'my_id'
+ tok_id(tok_this) == 'my_id'
+ #(tok_this) == 'my_id'
- name: tok_lemma
sig: |
@@ -42,8 +45,8 @@ fn-token:
for the current token (default) or the provided one by the optional paremeter <code><b>t</b></code>.
usage: |
// Result: 'true' if the current token lemma is equal to 'work'.
- tok_lemma() == 'work'
- tok_lemma(tok_this()) == 'work'
+ tok_lemma == 'work'
+ tok_lemma(tok_this) == 'work'
- name: tok_stem
sig: |
@@ -54,8 +57,8 @@ fn-token:
for the current token (default) or the provided one by the optional paremeter <code><b>t</b></code>.
usage: |
// Result: 'true' if the current token stem is equal to 'work'.
- tok_stem() == 'work'
- tok_stem(tok_this()) == 'work'
+ tok_stem == 'work'
+ tok_stem(tok_this) == 'work'
- name: tok_pos
sig: |
@@ -66,8 +69,8 @@ fn-token:
for the current token (default) or the provided one by the optional paremeter <code><b>t</b></code>.
usage: |
// Result: 'true' if the current token PoS tag is equal to 'NN'.
- tok_pos() == 'NN'
- tok_pos(tok_this()) == 'NN'
+ tok_pos == 'NN'
+ tok_pos(tok_this) == 'NN'
- name: tok_sparsity
sig: |
@@ -78,8 +81,8 @@ fn-token:
for the current token (default) or the provided one by the optional paremeter <code><b>t</b></code>.
usage: |
// Result: token sparsity value.
- tok_sparsity()
- tok_sparsity(tok_this())
+ tok_sparsity
+ tok_sparsity(tok_this)
- name: tok_unid
sig: |
@@ -90,8 +93,8 @@ fn-token:
for the current token (default) or the provided one by the optional paremeter <code><b>t</b></code>.
usage: |
// Result: internal token globally unique ID.
- tok_unid()
- tok_unid(tok_this())
+ tok_unid
+ tok_unid(tok_this)
- name: tok_is_abstract
sig: |
@@ -102,8 +105,8 @@ fn-token:
for the current token (default) or the provided one by the optional paremeter <code><b>t</b></code>.
usage: |
// Result: token abstract flag.
- tok_is_abstract()
- tok_is_abstract(tok_this())
+ tok_is_abstract
+ tok_is_abstract(tok_this)
- name: tok_is_bracketed
sig: |
@@ -114,8 +117,8 @@ fn-token:
for the current token (default) or the provided one by the optional paremeter <code><b>t</b></code>.
usage: |
// Result: token bracketed flag.
- tok_is_bracketed()
- tok_is_bracketed(tok_this())
+ tok_is_bracketed
+ tok_is_bracketed(tok_this)
- name: tok_is_direct
sig: |
@@ -126,8 +129,8 @@ fn-token:
for the current token (default) or the provided one by the optional paremeter <code><b>t</b></code>.
usage: |
// Result: token direct flag.
- tok_is_direct()
- tok_is_direct(tok_this())
+ tok_is_direct
+ tok_is_direct(tok_this)
- name: tok_is_permutated
sig: |
@@ -138,8 +141,8 @@ fn-token:
for the current token (default) or the provided one by the optional paremeter <code><b>t</b></code>.
usage: |
// Result: token permutated flag.
- tok_is_permutated()
- tok_is_permutated(tok_this())
+ tok_is_permutated
+ tok_is_permutated(tok_this)
- name: tok_is_english
sig: |
@@ -150,8 +153,8 @@ fn-token:
for the current token (default) or the provided one by the optional paremeter <code><b>t</b></code>.
usage: |
// Result: token English detection flag.
- tok_is_english()
- tok_is_english(tok_this())
+ tok_is_english
+ tok_is_english(tok_this)
- name: tok_is_freeword
sig: |
@@ -162,8 +165,8 @@ fn-token:
for the current token (default) or the provided one by the optional paremeter <code><b>t</b></code>.
usage: |
// Result: token freeword flag.
- tok_is_freeword()
- tok_is_freeword(tok_this())
+ tok_is_freeword
+ tok_is_freeword(tok_this)
- name: tok_is_quoted
sig: |
@@ -174,8 +177,8 @@ fn-token:
for the current token (default) or the provided one by the optional paremeter <code><b>t</b></code>.
usage: |
// Result: token quoted flag.
- tok_is_quoted()
- tok_is_quoted(tok_this())
+ tok_is_quoted
+ tok_is_quoted(tok_this)
- name: tok_is_stopword
sig: |
@@ -186,8 +189,8 @@ fn-token:
for the current token (default) or the provided one by the optional paremeter <code><b>t</b></code>.
usage: |
// Result: token stopword flag.
- tok_is_stopword()
- tok_is_stopword(tok_this())
+ tok_is_stopword
+ tok_is_stopword(tok_this)
- name: tok_is_swear
sig: |
@@ -198,8 +201,8 @@ fn-token:
for the current token (default) or the provided one by the optional paremeter <code><b>t</b></code>.
usage: |
// Result: token swear flag.
- tok_is_swear()
- tok_is_swear(tok_this())
+ tok_is_swear
+ tok_is_swear(tok_this)
- name: tok_is_user
sig: |
@@ -210,8 +213,8 @@ fn-token:
for the current token (default) or the provided one by the optional paremeter <code><b>t</b></code>.
usage: |
// Result: wether or not this is defined by user model element vs. built-in,
- tok_is_user()
- tok_is_user(tok_this())
+ tok_is_user
+ tok_is_user(tok_this)
- name: tok_is_wordnet
sig: |
@@ -222,8 +225,8 @@ fn-token:
for the current token (default) or the provided one by the optional paremeter <code><b>t</b></code>.
usage: |
// Result: whether or not this token is part of WordNet dictionary.
- tok_is_wordnet()
- tok_is_wordnet(tok_this())
+ tok_is_wordnet
+ tok_is_wordnet(tok_this)
- name: tok_ancestors
sig: |
@@ -236,8 +239,8 @@ fn-token:
May return an empty list but never a <code>null</code>.
usage: |
// Result: list of all ancestors.
- tok_ancestors()
- tok_ancestors(tok_this())
+ tok_ancestors
+ tok_ancestors(tok_this)
- name: tok_parent
sig: |
@@ -250,8 +253,8 @@ fn-token:
this will return <code>null</code>.
usage: |
// Result: list of all ancestors.
- tok_parent()
- tok_parent(tok_this())
+ tok_parent
+ tok_parent(tok_this)
- name: tok_groups
sig: |
@@ -264,8 +267,8 @@ fn-token:
May return an empty list but never a <code>null</code>.
usage: |
// Result: list of groups this token belongs to.
- tok_groups()
- tok_groups(tok_this())
+ tok_groups
+ tok_groups(tok_this)
- name: tok_value
sig: |
@@ -278,8 +281,8 @@ fn-token:
model elements - built-in tokens do not have values and it will return <code>null</code>.
usage: |
// Result: the token value if this token was detected via element's value
- tok_value()
- tok_value(tok_this())
+ tok_value
+ tok_value(tok_this)
- name: tok_aliases
sig: |
@@ -292,8 +295,8 @@ fn-token:
that token can have zero, one or more aliases. May return an empty list but never a <code>null</code>.
usage: |
// Result: checks if this token is known by 'alias' alias.
- has(tok_aliases(), 'alias')
- has(tok_aliases(tok_this()), 'alias')
+ has(tok_aliases, 'alias')
+ has(tok_aliases(tok_this), 'alias')
- name: tok_start_idx
sig: |
@@ -304,8 +307,8 @@ fn-token:
of the current token (default) or the provided one by the optional paremeter <code><b>t</b></code> in the original text.
usage: |
// Result: start character index of this token in the original text.
- tok_start_idx()
- tok_start_idx(tok_this())
+ tok_start_idx
+ tok_start_idx(tok_this)
- name: tok_end_idx
sig: |
@@ -317,18 +320,18 @@ fn-token:
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()
- tok_end_idx(tok_this())
+ tok_end_idx
+ tok_end_idx(tok_this)
- name: tok_this
sig: |
- <b>tok_this</b>() ⇒ Token
+ <b>tok_this</b> ⇒ Token
synopsis: Returns current token.
desc: |
Returns current token.
usage: |
// Result: current token.
- tok_this()
+ tok_this
- name: tok_find_part
sig: |
@@ -343,7 +346,7 @@ fn-token:
usage: |
// Result: part token of the current token found by 'alias' alias,
// if any, or throws runtime exception.
- tok_find_part(tok_this(), 'alias')
+ tok_find_part(tok_this, 'alias')
- name: tok_has_part
sig: |
@@ -355,10 +358,10 @@ fn-token:
parameter. See also <code>if()</code> function for 'if-then-else' branching support.
usage: |
// Result: 'true' if part token of the current token found by 'alias' alias, 'false' otherwise.
- tok_has_part(tok_this(), 'alias')
+ tok_has_part(tok_this, 'alias')
// Result: part token 'alias' if it exists or the current token if it does not.
- @this = tok_this()
+ @this = tok_this
@tok = if(tok_has_part(@this, 'alias'), tok_find_part(@this, 'alias'), @this)
- name: tok_find_parts
@@ -371,10 +374,10 @@ fn-token:
may return an empty list but never a <code>null</code>.
usage: |
// Result: list of part tokens, potentially empty, of the current token found by 'alias' alias.
- tok_find_parts(tok_this(), 'alias')
+ tok_find_parts(tok_this, 'alias')
// Result: part token 'alias' if it exists or the current token if it does not.
- @this = tok_this()
+ @this = tok_this
@parts = tok_find_parts(@this, 'alias')
@tok = if(is_empty(@parts), @this, first(@parts))
@@ -387,8 +390,8 @@ fn-token:
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
+ tok_index == 1
+ tok_index(tok_this) == 1
- name: tok_is_first
sig: |
@@ -399,8 +402,8 @@ fn-token:
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())
+ tok_is_first
+ tok_is_first(tok_this)
- name: tok_is_last
sig: |
@@ -411,8 +414,8 @@ fn-token:
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())
+ tok_is_last
+ tok_is_last(tok_this)
- name: tok_is_before_id
sig: |
@@ -496,26 +499,26 @@ fn-token:
- name: tok_all
sig: |
- <b>tok_all</b>() ⇒ List[Token]
+ <b>tok_all</b> ⇒ List[Token]
synopsis: |
Returns all tokens from the original input
desc: |
Returns all tokens from the original input.
usage: |
// Result: list of all tokens for the original input.
- tok_all()
+ tok_all
- name: tok_count
sig: |
- <b>tok_count</b>() ⇒ Long
+ <b>tok_count</b> ⇒ Long
synopsis: |
Returns number of tokens from the original input
desc: |
Returns number of tokens from the original input.
- It is equivalent to <code>size(tok_all())</code>
+ It is equivalent to <code>size(tok_all)</code>
usage: |
// Result: number of all tokens for the original input.
- tok_count()
+ tok_count
- name: tok_all_for_id
sig: |
@@ -553,330 +556,330 @@ fn-token:
fn-datetime:
- name: year
sig: |
- <b>year</b>() ⇒ Long
+ <b>year</b> ⇒ Long
synopsis: Returns current year
desc: |
Returns current year.
usage: |
// Result: 2021
- year()
+ year
- name: month
sig: |
- <b>month</b>() ⇒ Long
+ <b>month</b> ⇒ Long
synopsis: |
Returns current month: 1 ... 12
desc: |
Returns current month: 1 ... 12.
usage: |
// Result: 5
- month()
+ month
- name: day_of_month
sig: |
- <b>day_of_month</b>() ⇒ Long
+ <b>day_of_month</b> ⇒ Long
synopsis: |
Returns current day of the month: 1 ... 31
desc: |
Returns current day of the month: 1 ... 31.
usage: |
// Result: 5
- day_of_month()
+ day_of_month
- name: day_of_week
sig: |
- <b>day_of_week</b>() ⇒ Long
+ <b>day_of_week</b> ⇒ Long
synopsis: |
Returns current day of the week: 1 ... 7
desc: |
Returns current day of the week: 1 ... 7.
usage: |
// Result: 5
- day_of_week()
+ day_of_week
- name: day_of_year
sig: |
- <b>day_of_year</b>() ⇒ Long
+ <b>day_of_year</b> ⇒ Long
synopsis: |
Returns current day of the year: 1 ... 365
desc: |
Returns current day of the year: 1 ... 365.
usage: |
// Result: 51
- day_of_year()
+ day_of_year
- name: hour
sig: |
- <b>hour</b>() ⇒ Long
+ <b>hour</b> ⇒ Long
synopsis: |
Returns current hour: 0 ... 23
desc: |
Returns current hour: 0 ... 23.
usage: |
// Result: 11
- hour()
+ hour
- name: minute
sig: |
- <b>minute</b>() ⇒ Long
+ <b>minute</b> ⇒ Long
synopsis: |
Returns current minute: 0 ... 59
desc: |
Returns current minute: 0 ... 59.
usage: |
// Result: 11
- minute()
+ minute
- name: second
sig: |
- <b>second</b>() ⇒ Long
+ <b>second</b> ⇒ Long
synopsis: |
Returns current second: 0 ... 59
desc: |
Returns current second: 0 ... 59.
usage: |
// Result: 11
- second()
+ second
- name: week_of_month
sig: |
- <b>week_of_month</b>() ⇒ Long
+ <b>week_of_month</b> ⇒ Long
synopsis: |
Returns current week of the month: 1 ... 4
desc: |
Returns current week of the month: 1 ... 4.
usage: |
// Result: 2
- week_of_month()
+ week_of_month
- name: week_of_year
sig: |
- <b>week_of_year</b>() ⇒ Long
+ <b>week_of_year</b> ⇒ Long
synopsis: |
Returns current week of the year: 1 ... 56
desc: |
Returns current week of the year: 1 ... 56.
usage: |
// Result: 21
- week_of_year()
+ week_of_year
- name: quarter
sig: |
- <b>quarter</b>() ⇒ Long
+ <b>quarter</b> ⇒ Long
synopsis: |
Returns current quarter: 1 ...4
desc: |
Returns current quarter: 1 ... 4.
usage: |
// Result: 2
- quarter()
+ quarter
- name: now
sig: |
- <b>now</b>() ⇒ Long
+ <b>now</b> ⇒ Long
synopsis: |
Returns current time in milliseconds
desc: |
Returns current time in milliseconds.
usage: |
// Result: 122312341212
- now()
+ now
fn-req:
- name: req_id
sig: |
- <b>req_id</b>() ⇒ String
+ <b>req_id</b> ⇒ String
synopsis: Returns <a class="not-code" target="javadoc" href="/apis/latest/org/apache/nlpcraft/model/NCRequest.html#getServerRequestId()">server request ID</a>
desc: |
Returns <a class="not-code" target="javadoc" href="/apis/latest/org/apache/nlpcraft/model/NCRequest.html#getServerRequestId()">server request ID</a>.
usage: |
// Result: server request ID.
- req_id()
+ req_id
- name: req_normtext
sig: |
- <b>req_normtext</b>() ⇒ String
+ <b>req_normtext</b> ⇒ String
synopsis: Returns request <a class="not-code" target="javadoc" href="/apis/latest/org/apache/nlpcraft/model/NCRequest.html#getNormalizedText()">normalied text</a>
desc: |
Returns request <a class="not-code" target="javadoc" href="/apis/latest/org/apache/nlpcraft/model/NCRequest.html#getNormalizedText()">normalized text</a>.
usage: |
// Result: request normalized text.
- req_normtext()
+ req_normtext
- name: req_tstamp
sig: |
- <b>req_tstamp</b>() ⇒ Long
+ <b>req_tstamp</b> ⇒ Long
synopsis: Gets UTC/GMT receive <a class="not-code" target="javadoc" href="/apis/latest/org/apache/nlpcraft/model/NCRequest.html#getNormalizedText()">timestamp</a>
desc: |
Gets UTC/GMT <a class="not-code" target="javadoc" href="/apis/latest/org/apache/nlpcraft/model/NCRequest.html#getNormalizedText()">timestamp</a>
in ms when user input was received.
usage: |
// Result: input receive timsstamp in ms.
- req_tstamp()
+ req_tstamp
- name: req_addr
sig: |
- <b>req_addr</b>() ⇒ String
+ <b>req_addr</b> ⇒ String
synopsis: Gets remote client <a class="not-code" target="javadoc" href="/apis/latest/org/apache/nlpcraft/model/NCRequest.html#getRemoteAddress()">address</a>
desc: |
Gets remote client <a class="not-code" target="javadoc" href="/apis/latest/org/apache/nlpcraft/model/NCRequest.html#getRemoteAddress()">address</a> that made the original REST call.
Returns <code>null</code> if remote client address is not available.
usage: |
// Result: remote client address or 'null'.
- req_addr()
+ req_addr
- name: req_agent
sig: |
- <b>req_agent</b>() ⇒ String
+ <b>req_agent</b> ⇒ String
synopsis: Gets remote client <a class="not-code" target="javadoc" href="/apis/latest/org/apache/nlpcraft/model/NCRequest.html#getClientAgent()">agent</a>
desc: |
Gets remote client <a class="not-code" target="javadoc" href="/apis/latest/org/apache/nlpcraft/model/NCRequest.html#getRemoteClientAgent()">agent</a> that made the original REST call.
Returns <code>null</code> if remote client agent is not available.
usage: |
// Result: remote client agent or 'null'.
- req_agent()
+ req_agent
fn-user:
- name: user_id
sig: |
- <b>user_id</b>() ⇒ String
+ <b>user_id</b> ⇒ String
synopsis: Returns <a class="not-code" target="javadoc" href="/apis/latest/org/apache/nlpcraft/model/NCUser.html#getId()">user ID</a>
desc: |
Returns <a class="not-code" target="javadoc" href="/apis/latest/org/apache/nlpcraft/model/NCUser.html#getId()">user ID</a>.
usage: |
// Result: user ID.
- user_id()
+ user_id
- name: user_fname
sig: |
- <b>user_fname</b>() ⇒ String
+ <b>user_fname</b> ⇒ String
synopsis: Returns <a class="not-code" target="javadoc" href="/apis/latest/org/apache/nlpcraft/model/NCUser.html#getFirstName()">user first name</a>
desc: |
Returns <a class="not-code" target="javadoc" href="/apis/latest/org/apache/nlpcraft/model/NCUser.html#getFirstName()">user first name</a>.
usage: |
// Result: user first name.
- user_fname()
+ user_fname
- name: user_lname
sig: |
- <b>user_lname</b>() ⇒ String
+ <b>user_lname</b> ⇒ String
synopsis: Returns <a class="not-code" target="javadoc" href="/apis/latest/org/apache/nlpcraft/model/NCUser.html#getLastName()">user last name</a>
desc: |
Returns <a class="not-code" target="javadoc" href="/apis/latest/org/apache/nlpcraft/model/NCUser.html#getLastName()">user last name</a>.
usage: |
// Result: user last name.
- user_lname()
+ user_lname
- name: user_email
sig: |
- <b>user_email</b>() ⇒ String
+ <b>user_email</b> ⇒ String
synopsis: Returns <a class="not-code" target="javadoc" href="/apis/latest/org/apache/nlpcraft/model/NCUser.html#getEmail()">user email</a>
desc: |
Returns <a class="not-code" target="javadoc" href="/apis/latest/org/apache/nlpcraft/model/NCUser.html#getEmail()">user email</a>.
usage: |
// Result: user email.
- user_email()
+ user_email
- name: user_admin
sig: |
- <b>user_admin</b>() ⇒ Boolean
+ <b>user_admin</b> ⇒ Boolean
synopsis: Returns <a class="not-code" target="javadoc" href="/apis/latest/org/apache/nlpcraft/model/NCUser.html#isAdmin()">user admin</a> flag
desc: |
Returns <a class="not-code" target="javadoc" href="/apis/latest/org/apache/nlpcraft/model/NCUser.html#isAdmin()">user admin</a> flag.
usage: |
// Result: user admin flag.
- user_admin()
+ user_admin
- name: user_signup_tstamp
sig: |
- <b>user_signup_tstamp</b>() ⇒ Long
+ <b>user_signup_tstamp</b> ⇒ Long
synopsis: Returns <a class="not-code" target="javadoc" href="/apis/latest/org/apache/nlpcraft/model/NCUser.html#getSignupTimestamp()">user signup timestamp</a>
desc: |
Returns <a class="not-code" target="javadoc" href="/apis/latest/org/apache/nlpcraft/model/NCUser.html#getSignupTimestamp()">user signup timestamp</a>.
usage: |
// Result: user signup timestamp in milliseconds.
- user_signup_tstamp()
+ user_signup_tstamp
fn-company:
- name: comp_id
sig: |
- <b>comp_id</b>() ⇒ String
+ <b>comp_id</b> ⇒ String
synopsis: Returns <a class="not-code" target="javadoc" href="/apis/latest/org/apache/nlpcraft/model/NCCompany.html#getId()">company ID</a>
desc: |
Returns <a class="not-code" target="javadoc" href="/apis/latest/org/apache/nlpcraft/model/NCCompany.html#getId()">company ID</a>.
usage: |
// Result: company ID.
- comp_id()
+ comp_id
- name: comp_name
sig: |
- <b>comp_name</b>() ⇒ String
+ <b>comp_name</b> ⇒ String
synopsis: Returns <a class="not-code" target="javadoc" href="/apis/latest/org/apache/nlpcraft/model/NCCompany.html#getName()">company name</a>
desc: |
Returns <a class="not-code" target="javadoc" href="/apis/latest/org/apache/nlpcraft/model/NCCompany.html#getName()">company name</a>.
usage: |
// Result: company name.
- comp_name()
+ comp_name
- name: comp_website
sig: |
- <b>comp_website</b>() ⇒ String
+ <b>comp_website</b> ⇒ String
synopsis: Returns <a class="not-code" target="javadoc" href="/apis/latest/org/apache/nlpcraft/model/NCCompany.html#getWebsite()">company website</a>
desc: |
Returns <a class="not-code" target="javadoc" href="/apis/latest/org/apache/nlpcraft/model/NCCompany.html#getWebsite()">company website</a>.
usage: |
// Result: company website.
- comp_website()
+ comp_website
- name: comp_country
sig: |
- <b>comp_country</b>() ⇒ String
+ <b>comp_country</b> ⇒ String
synopsis: Returns <a class="not-code" target="javadoc" href="/apis/latest/org/apache/nlpcraft/model/NCCompany.html#getCountry()">company country</a>
desc: |
Returns <a class="not-code" target="javadoc" href="/apis/latest/org/apache/nlpcraft/model/NCCompany.html#getCountry()">company country</a>.
usage: |
// Result: company country.
- comp_country()
+ comp_country
- name: comp_region
sig: |
- <b>comp_region</b>() ⇒ String
+ <b>comp_region</b> ⇒ String
synopsis: Returns <a class="not-code" target="javadoc" href="/apis/latest/org/apache/nlpcraft/model/NCCompany.html#getRegion()">company region</a>
desc: |
Returns <a class="not-code" target="javadoc" href="/apis/latest/org/apache/nlpcraft/model/NCCompany.html#getRegion()">company region</a>.
usage: |
// Result: company region.
- comp_region()
+ comp_region
- name: comp_city
sig: |
- <b>comp_city</b>() ⇒ String
+ <b>comp_city</b> ⇒ String
synopsis: Returns <a class="not-code" target="javadoc" href="/apis/latest/org/apache/nlpcraft/model/NCCompany.html#getCity()">company city</a>
desc: |
Returns <a class="not-code" target="javadoc" href="/apis/latest/org/apache/nlpcraft/model/NCCompany.html#getCity()">company city</a>.
usage: |
// Result: company region.
- comp_city()
+ comp_city
- name: comp_addr
sig: |
- <b>comp_addr</b>() ⇒ String
+ <b>comp_addr</b> ⇒ String
synopsis: Returns <a class="not-code" target="javadoc" href="/apis/latest/org/apache/nlpcraft/model/NCCompany.html#getAddress()">company address</a>
desc: |
Returns <a class="not-code" target="javadoc" href="/apis/latest/org/apache/nlpcraft/model/NCCompany.html#getAddress()">company address</a>.
usage: |
// Result: company address.
- comp_addr()
+ comp_addr
- name: comp_postcode
sig: |
- <b>comp_postcode</b>() ⇒ String
+ <b>comp_postcode</b> ⇒ String
synopsis: Returns <a class="not-code" target="javadoc" href="/apis/latest/org/apache/nlpcraft/model/NCCompany.html#getPostalCode()">company postal code</a>
desc: |
Returns <a class="not-code" target="javadoc" href="/apis/latest/org/apache/nlpcraft/model/NCCompany.html#getPostalCode()">company postal code</a>.
usage: |
// Result: company postal code.
- comp_postcode()
+ comp_postcode
fn-math:
- name: abs
@@ -1126,23 +1129,23 @@ fn-math:
- name: pi
sig: |
- <b>pi</b>() ⇒ Double
+ <b>pi</b> ⇒ Double
synopsis: Returns PI constant
desc: |
Returns PI constant.
usage: |
// Result: 3.14159265359
- pi()
+ pi
- name: euler
sig: |
- <b>pi</b>() ⇒ Double
+ <b>pi</b> ⇒ Double
synopsis: Returns Euler constant
desc: |
Returns Euler constant.
usage: |
// Result: 0.5772156649
- euler()
+ euler
- name: max
sig: |
@@ -1219,7 +1222,7 @@ fn-collections:
Returns new list with given parameters.
usage: |
// Result: []
- list()
+ list
// Result: [1, 2, 3]
list(1, 2, 3)
// Result: ["1", true, 1.25]
@@ -1545,7 +1548,7 @@ fn-text:
synopsis: Returns size or length of the given string, list or map
desc: |
Returns size or length of the given string, list or map. This function has
- aliases: <code><b>size()</b></code> and <code><b>count()</b></code>.
+ aliases: <code><b>size</b></code> and <code><b>count</b></code>.
usage: |
// Result: 9
length("some text")
@@ -1561,7 +1564,7 @@ fn-text:
synopsis: Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/String.html#trim()"><code>String.trim()</code></a>
desc: |
Calls <a target="javadoc" href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/String.html#trim()"><code>String.trim()</code></a> on
- given parameter <code><b>p</b></code> and returns its result. This function has alias: <code><b>strip()</b></code>
+ given parameter <code><b>p</b></code> and returns its result. This function has alias: <code><b>strip</b></code>
usage: |
// Result: "text"
trim(" text ")
@@ -1592,9 +1595,9 @@ fn-text:
- name: is_alpha
sig: |
<b>is_alpha</b>(p: String) ⇒ Boolean
- synopsis: Calls <a target="javadoc" href="http://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#isAlpha-java.lang.CharSequence-"><code>StringUtils.isAlpha()</code></a>
+ synopsis: Calls <a target="javadoc" href="https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#isAlpha-java.lang.CharSequence-"><code>StringUtils.isAlpha()</code></a>
desc: |
- Calls <a target="asf" href="http://commons.apache.org/">Apache Commons</a> <a target="javadoc" href="http://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#isAlpha-java.lang.CharSequence-"><code>StringUtils.isAlpha()</code></a>
+ Calls <a target="asf" href="https://commons.apache.org/">Apache Commons</a> <a target="javadoc" href="https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#isAlpha-java.lang.CharSequence-"><code>StringUtils.isAlpha()</code></a>
on given parameter <code><b>p</b></code> and returns its result.
usage: |
// Result: true
@@ -1603,9 +1606,9 @@ fn-text:
- name: is_alphanum
sig: |
<b>is_alphanum</b>(p: String) ⇒ Boolean
- synopsis: Calls <a target="javadoc" href="http://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#isAlphanumeric-java.lang.CharSequence-"><code>StringUtils.isAlphanumeric()</code></a>
+ synopsis: Calls <a target="javadoc" href="https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#isAlphanumeric-java.lang.CharSequence-"><code>StringUtils.isAlphanumeric()</code></a>
desc: |
- Calls <a target="asf" href="http://commons.apache.org/">Apache Commons</a> <a target="javadoc" href="http://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#isAlphanumeric-java.lang.CharSequence-"><code>StringUtils.isAlphanumeric()</code></a>
+ Calls <a target="asf" href="https://commons.apache.org/">Apache Commons</a> <a target="javadoc" href="https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#isAlphanumeric-java.lang.CharSequence-"><code>StringUtils.isAlphanumeric()</code></a>
on given parameter <code><b>p</b></code> and returns its result.
usage: |
// Result: true
@@ -1614,9 +1617,9 @@ fn-text:
- name: is_whitespace
sig: |
<b>is_whitespace</b>(p: String) ⇒ Boolean
- synopsis: Calls <a target="javadoc" href="http://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#isWhitespace-java.lang.CharSequence-"><code>StringUtils.isWhitespace()</code></a>
+ synopsis: Calls <a target="javadoc" href="https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#isWhitespace-java.lang.CharSequence-"><code>StringUtils.isWhitespace()</code></a>
desc: |
- Calls <a target="asf" href="http://commons.apache.org/">Apache Commons</a> <a target="javadoc" href="http://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#isWhitespace-java.lang.CharSequence-"><code>StringUtils.isWhitespace()</code></a>
+ Calls <a target="asf" href="https://commons.apache.org/">Apache Commons</a> <a target="javadoc" href="https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#isWhitespace-java.lang.CharSequence-"><code>StringUtils.isWhitespace()</code></a>
on given parameter <code><b>p</b></code> and returns its result.
usage: |
// Result: false
@@ -1627,9 +1630,9 @@ fn-text:
- name: is_num
sig: |
<b>is_num</b>(p: String) ⇒ Boolean
- synopsis: Calls <a target="javadoc" href="http://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#isNumeric-java.lang.CharSequence-"><code>StringUtils.isNumeric()</code></a>
+ synopsis: Calls <a target="javadoc" href="https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#isNumeric-java.lang.CharSequence-"><code>StringUtils.isNumeric()</code></a>
desc: |
- Calls <a target="asf" href="http://commons.apache.org/">Apache Commons</a> <a target="javadoc" href="http://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#isNumeric-java.lang.CharSequence-"><code>StringUtils.isNumeric()</code></a>
+ Calls <a target="asf" href="https://commons.apache.org/">Apache Commons</a> <a target="javadoc" href="https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#isNumeric-java.lang.CharSequence-"><code>StringUtils.isNumeric()</code></a>
on given parameter <code><b>p</b></code> and returns its result.
usage: |
// Result: true
@@ -1638,9 +1641,9 @@ fn-text:
- name: is_numspace
sig: |
<b>is_numspace</b>(p: String) ⇒ Boolean
- synopsis: Calls <a target="javadoc" href="http://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#isNumericSpace-java.lang.CharSequence-"><code>StringUtils.isNumericSpace()</code></a>
+ synopsis: Calls <a target="javadoc" href="https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#isNumericSpace-java.lang.CharSequence-"><code>StringUtils.isNumericSpace()</code></a>
desc: |
- Calls <a target="asf" href="http://commons.apache.org/">Apache Commons</a> <a target="javadoc" href="http://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#isNumericSpace-java.lang.CharSequence-"><code>StringUtils.isNumericSpace()</code></a>
+ Calls <a target="asf" href="https://commons.apache.org/">Apache Commons</a> <a target="javadoc" href="https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#isNumericSpace-java.lang.CharSequence-"><code>StringUtils.isNumericSpace()</code></a>
on given parameter <code><b>p</b></code> and returns its result.
usage: |
// Result: true
@@ -1649,9 +1652,9 @@ fn-text:
- name: is_alphaspace
sig: |
<b>is_alphaspace</b>(p: String) ⇒ Boolean
- synopsis: Calls <a target="javadoc" href="http://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#isAlphaSpace-java.lang.CharSequence-"><code>StringUtils.isAlphaSpace()</code></a>
+ synopsis: Calls <a target="javadoc" href="https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#isAlphaSpace-java.lang.CharSequence-"><code>StringUtils.isAlphaSpace()</code></a>
desc: |
- Calls <a target="asf" href="http://commons.apache.org/">Apache Commons</a> <a target="javadoc" href="http://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#isAlphaSpace-java.lang.CharSequence-"><code>StringUtils.isAlphaSpace()</code></a>
+ Calls <a target="asf" href="https://commons.apache.org/">Apache Commons</a> <a target="javadoc" href="https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#isAlphaSpace-java.lang.CharSequence-"><code>StringUtils.isAlphaSpace()</code></a>
on given parameter <code><b>p</b></code> and returns its result.
usage: |
// Result: true
@@ -1660,9 +1663,9 @@ fn-text:
- name: is_alphanumspace
sig: |
<b>is_alphanumspace</b>(p: String) ⇒ Boolean
- synopsis: Calls <a target="javadoc" href="http://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#isAlphaNumericSpace-java.lang.CharSequence-"><code>StringUtils.isAlphaNumericSpace()</code></a>
+ synopsis: Calls <a target="javadoc" href="https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#isAlphaNumericSpace-java.lang.CharSequence-"><code>StringUtils.isAlphaNumericSpace()</code></a>
desc: |
- Calls <a target="asf" href="http://commons.apache.org/">Apache Commons</a> <a target="javadoc" href="http://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#isAlphaNumericSpace-java.lang.CharSequence-"><code>StringUtils.isAlphaNumericSpace()</code></a>
+ Calls <a target="asf" href="https://commons.apache.org/">Apache Commons</a> <a target="javadoc" href="https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#isAlphaNumericSpace-java.lang.CharSequence-"><code>StringUtils.isAlphaNumericSpace()</code></a>
on given parameter <code><b>p</b></code> and returns its result.
usage: |
// Result: true
diff --git a/blogs/nlpcraft-idl-intent-definition-language.html b/blogs/nlpcraft-idl-intent-definition-language.html
index 75411a7..2e8d923 100644
--- a/blogs/nlpcraft-idl-intent-definition-language.html
+++ b/blogs/nlpcraft-idl-intent-definition-language.html
@@ -58,18 +58,17 @@ publish_date: June 3, 2021
intent=xa
flow="^(?:login)(^:logout)*$"
meta={'enabled': true}
- term(a)={!(tok_id()) != "z"}[1,3]
+ term(a)={# != "z"}[1,3]
term(b)={
meta_intent('enabled') == true && // Must be active.
- month() == 1 // January.
+ month == 1 // January.
}
term(c)~{
// Variables.
- @tokId = tok_id()
@usrTypes = meta_model('user_types')
// Predicate.
- (tokId == 'order' || tokId == 'order_cancel') &&
+ (# == 'order' || # == 'order_cancel') &&
has_all(@usrTypes, list(1, 2, 3) &&
abs(meta_tok('order:size')) > 10)
</pre>
@@ -237,7 +236,7 @@ publish_date: June 3, 2021
intent=xa
flow="^(?:login)(^:logout)*$"
meta={'enabled': true}
- term(a)={!(tok_id()) != "z"}[1,3]
+ term(a)={# != "z"}[1,3]
</pre>
<p>
Every intent statement consists of the following elements:
@@ -285,8 +284,8 @@ publish_date: June 3, 2021
Example terms:
</p>
<pre class="brush: idl">
- term(nums)~{tok_id() == 'nlpcraft:num'} // Conversational '~' term.
- term(nums)={tok_id() != 'z'} // Non-conversational '=' term.
+ term(nums)~{# == 'nlpcraft:num'} // Conversational '~' term.
+ term(nums)={# != 'z'} // Non-conversational '=' term.
</pre>
</li>
<li>
@@ -295,7 +294,7 @@ publish_date: June 3, 2021
using IDL script with built-in functions or in external Java-based code:
</p>
<pre class="brush: idl">
- term(nums)={tok_id() == 'nlpcraft:num'} // IDL script.
+ term(nums)={# == 'nlpcraft:num'} // IDL script.
term(yes)~{true} // IDL script.
term~/org.mypackage.MyClass#termMethod/? // Reference to external code.
</pre>
@@ -327,8 +326,8 @@ publish_date: June 3, 2021
Examples:
</p>
<pre class="brush: idl">
- term(nums)={tok_id() == 'nlpcraft:num'}[1,2] // The request must contain one or two tokens with the ID “nlpcraft: num”.
- term(nums)={tok_id() == 'nlpcraft:num'}* // The request must contain zero or more tokens with the ID “nlpcraft: num”.
+ term(nums)={# == 'nlpcraft:num'}[1,2] // The request must contain one or two tokens with the ID “nlpcraft: num”.
+ term(nums)={# == 'nlpcraft:num'}* // The request must contain zero or more tokens with the ID “nlpcraft: num”.
</pre>
</li>
</ul>
@@ -340,14 +339,14 @@ publish_date: June 3, 2021
be used in term definition. These functions can be conventionally classified into the following categories:
</p>
<ul class="fixed">
- <li>Based on base tokens properties - token IDs, groups, parent, hierarchy, etc. Examples: <code>tok_id()</code>, <code>tok_groups()</code>, <code>tok_parent()</code>.</li>
- <li>NLP-based tokens properties - stemmas, lemmas, parts of speech, stop words. Examples: <code>tok_lemma()</code>, <code>tok_is_wordnet()</code>, <code>tok_swear()</code>.</li>
- <li>Based on information about how the token was found in the user's request - synonym values, etc. Examples: <code>tok_value()</code>, <code>tok_is_permutated()</code>, <code>tok_is_direct()</code>.</li>
- <li>Based on user request data - request time, user agent type. Examples: <code>req_tstamp()</code>, <code>req_addr()</code>, <code>req_agent()</code>.</li>
+ <li>Based on base tokens properties - token IDs, groups, parent, hierarchy, etc. Examples: <code>tok_id</code>, <code>tok_groups</code>, <code>tok_parent</code>.</li>
+ <li>NLP-based tokens properties - stemmas, lemmas, parts of speech, stop words. Examples: <code>tok_lemma</code>, <code>tok_is_wordnet</code>, <code>tok_swear</code>.</li>
+ <li>Based on information about how the token was found in the user's request - synonym values, etc. Examples: <code>tok_value</code>, <code>tok_is_permutated</code>, <code>tok_is_direct</code>.</li>
+ <li>Based on user request data - request time, user agent type. Examples: <code>req_tstamp</code>, <code>req_addr</code>, <code>req_agent</code>.</li>
<li>Based on various metadata - tokens, model, request, etc. Examples: <code>meta_model('my: prop')</code>, <code>meta_tok('nlpcraft: num: unit')</code>, <code>meta_user('my: prop')</code>.</li>
<li>Based on data provided by NER token providers. Example, for <code>geo:city</code> token it can be the number of city residents or coordinates obtained from metadata.</li>
- <li>Based on the user and his company - admin status, registration time. Examples: <code>user_admin()</code>, <code>comp_name()</code>, <code>user_signup_tstamp()</code>.</li>
- <li>Based on system/environment variables, system time, etc. Examples:<code> meta_sys('java.home'), now(), day_of_week()</code>.</li>
+ <li>Based on the user and his company - admin status, registration time. Examples: <code>user_admin</code>, <code>comp_name</code>, <code>user_signup_tstamp</code>.</li>
+ <li>Based on system/environment variables, system time, etc. Examples:<code> meta_sys('java.home'), now, day_of_week</code>.</li>
<li>Math functions, text functions, collection functions, etc. Examples: <code>lowercase("TeXt")</code>, <code>abs(-1.5)</code>, <code>distinct(list(1, 2, 2, 3, 1))</code>.</li>
</ul>
<p>
@@ -402,7 +401,7 @@ publish_date: June 3, 2021
<pre class="brush: scala">
@NCIntent("intent=x
flow=/com.company.dialog.Flow#customFlow/
- term~{tok_id() == 'some_id'}"
+ term~{# == 'some_id'}"
)
def onX(): NCResult = { .. }
</pre>
diff --git a/blogs/quick_intro_apache_nlpcraft.html b/blogs/quick_intro_apache_nlpcraft.html
index 77c224f..ad223d9 100644
--- a/blogs/quick_intro_apache_nlpcraft.html
+++ b/blogs/quick_intro_apache_nlpcraft.html
@@ -233,7 +233,7 @@ publish_date: November 16, 2020
- "{<ACTION>|shut|kill|stop|eliminate} {off|out} <LIGHT>"
- "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'}*"
</pre>
<p><b>NOTES:</b></p>
<ul>
diff --git a/blogs/short_term_memory.html b/blogs/short_term_memory.html
index 36d8b3e..8ec3019 100644
--- a/blogs/short_term_memory.html
+++ b/blogs/short_term_memory.html
@@ -301,10 +301,10 @@ publish_date: July 26, 2019
have the following 4 intents:
</p>
<ul>
- <li><code>id=sale term={tok_id() == 'sale'}</code></li>
- <li><code>id=best_sale_person term={tok_id() == 'sale'} term={tok_id() == best_employee}</code></li>
- <li><code>id=buy term={tok_id() == 'buy'}</code></li>
- <li><code>id=buy_best_person term={tok_id() == 'buy'} term={tok_id() == best_employee}</code></li>
+ <li><code>id=sale term={# == 'sale'}</code></li>
+ <li><code>id=best_sale_person term={# == 'sale'} term={# == best_employee}</code></li>
+ <li><code>id=buy term={# == 'buy'}</code></li>
+ <li><code>id=buy_best_person term={# == 'buy'} term={# == best_employee}</code></li>
</ul>
<p>
(this is actual <a href="/intent-matching.html">Intent Definition Language</a> (IDL) used by NLPCraft -
diff --git a/data-model.html b/data-model.html
index 6a1f23e..9b96561 100644
--- a/data-model.html
+++ b/data-model.html
@@ -939,9 +939,9 @@ intents:
future individual sub-IDs. For example:
</p>
<pre class="brush: idl">
- intent=vehicle.intent term~{has(tok_ancestors(), 'vehicle')}
- intent=truck.intent term~{tok_parent() == 'truck'}
- intent=car.intent term~{tok_parent() == 'car'}
+ intent=vehicle.intent term~{has(tok_ancestors, 'vehicle')}
+ intent=truck.intent term~{tok_parent == 'truck'}
+ intent=car.intent term~{tok_parent == 'car'}
</pre>
</section>
<section id="syns-tools">
@@ -1210,7 +1210,7 @@ intents:
"id": "race.vehicle",
"description": "Race vehicle",
"synonyms": [
- "{race|speed|track} ^^{tok_id() == 'transport.vehicle'}^^"
+ "{race|speed|track} ^^{# == 'transport.vehicle'}^^"
]
}
@@ -1242,7 +1242,7 @@ intents:
"description": "Wrapper for google location",
"groups": ["my_group"],
"synonyms": [
- "^^{tok_id() == 'google:location'}^^"
+ "^^{# == 'google:location'}^^"
]
}
]
@@ -1259,7 +1259,7 @@ intents:
</p>
<pre class="brush: js">
"synonyms": [
- "population {of|for} ^^[city]{tok_id() == 'nlpcraft:city' && lowercase(meta_tok('city:country')) == 'france'}^^"
+ "population {of|for} ^^[city]{# == 'nlpcraft:city' && lowercase(meta_tok('city:country')) == 'france'}^^"
]
</pre>
<b>NOTES:</b>
diff --git a/examples/alarm_clock.html b/examples/alarm_clock.html
index dc55dad..a85af49 100644
--- a/examples/alarm_clock.html
+++ b/examples/alarm_clock.html
@@ -107,7 +107,7 @@ fa_icon: fa-cube
}
],
"intents": [
- "intent=alarm term~{tok_id() == 'x:alarm'} term(nums)~{tok_id() == 'nlpcraft:num' && meta_token('nlpcraft:num:unittype') == 'datetime' && meta_token('nlpcraft:num:isequalcondition') == true}[0,7]"
+ "intent=alarm term~{# == 'x:alarm'} term(nums)~{# == 'nlpcraft:num' && meta_token('nlpcraft:num:unittype') == 'datetime' && meta_token('nlpcraft:num:isequalcondition') == true}[0,7]"
]
}
</pre>
diff --git a/examples/light_switch.html b/examples/light_switch.html
index 7c90134..81fbaa3 100644
--- a/examples/light_switch.html
+++ b/examples/light_switch.html
@@ -140,7 +140,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'}*"
</pre>
<p>There are number of important points here:</p>
<ul>
diff --git a/first-example.html b/first-example.html
index 86b72d7..86ed542 100644
--- a/first-example.html
+++ b/first-example.html
@@ -165,7 +165,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'}*"
</pre>
<p>There are number of important points here:</p>
<ul>
diff --git a/intent-matching.html b/intent-matching.html
index 5251f6c..814aeb6 100644
--- a/intent-matching.html
+++ b/intent-matching.html
@@ -45,7 +45,7 @@ id: intent_matching
that model wants to react to.
</p>
<p>
- For example, a data model for banking chat bot or analytics application can have multiple intents for each domain-specific group of input such as
+ For example, a data model for banking chatbot or analytics application can have multiple intents for each domain-specific group of input such as
opening an account, closing an account, transferring money, getting statements, etc.
</p>
<p>
@@ -63,8 +63,8 @@ id: intent_matching
</p>
<pre class="brush: idl">
intent=x
- term(a)~{tok_id() == 'my_elm'}
- term(b)={has(tok_groups(), "my_group")}
+ term(a)~{# == 'my_elm'}
+ term(b)={has(tok_groups, "my_group")}
</pre>
<p>
IDL intent defines a match between the parsed user input represented as the collection of
@@ -143,12 +143,11 @@ id: intent_matching
intent=xa
flow="^(?:login)(^:logout)*$"
meta={'enabled': true}
- term(a)={month() >= 6 && !(tok_id()) != "z" && meta_intent('enabled') == true}[1,3]
+ term(a)={month >= 6 && !# != "z" && meta_intent('enabled') == true}[1,3]
term(b)~{
- @tokId = tok_id()
@usrTypes = meta_model('user_types')
- (tokId == 'order' || tokId == 'order_cancel') && has_all(@usrTypes, list(1, 2, 3))
+ (# == 'order' || # == 'order_cancel') && has_all(@usrTypes, list(1, 2, 3))
}
intent=xb
@@ -215,6 +214,9 @@ id: intent_matching
<li><code>tok_is_before_id()</code></li>
<li><code>tok_is_before_parent()</code></li>
<li><code>tok_is_before_group()</code></li>
+ <li><code>tok_is_between_ids()</code></li>
+ <li><code>tok_is_between_parents()</code></li>
+ <li><code>tok_is_between_groups()</code></li>
<li><code>tok_is_after_id()</code></li>
<li><code>tok_is_after_parent()</code></li>
<li><code>tok_is_after_group()</code></li>
@@ -296,7 +298,7 @@ id: intent_matching
<code>"login logout"</code> or <code>"order login"</code> history this dialog flow will not match.
</p>
</li>
- <li>
+ <li id="user-defined-callback">
<p><b>User-Defined Callback</b></p>
<p>
In this case the dialog flow specification is defined as a callback in a form <code>/x.y.z.Cass#method/</code>,
@@ -330,15 +332,14 @@ id: intent_matching
instance and can be accessed in intent's terms via
<a href="#idl_functions"><code>meta_intent()</code></a> IDL function.
The typical use case for declarative intent metadata is to parameterize its behavior, i.e. the behavior of its terms,
- with a clearly defined properties that are provided right inside of intent definition itself.
+ with a clearly defined properties that are provided inside intent definition itself.
</p>
</dd>
<dt>
- <code>term(a)={month() >= 6 && !(tok_id()) != "z" && meta_intent('enabled') == true}[1,3]</code> <sup><small>line 4</small></sup><br>
+ <code>term(a)={month >= 6 && !# != "z" && meta_intent('enabled') == true}[1,3]</code> <sup><small>line 4</small></sup><br>
<code>term(b)~{</code> <sup><small>line 5</small></sup><br>
- <code style="padding-left: 20px">@tokId = tok_id()</code><br>
<code style="padding-left: 20px">@usrTypes = meta_model('user_types')</code><br>
- <code style="padding-left: 20px">(tokId == 'order' || tokId == 'order_cancel') && has_all(@usrTypes, list(1, 2, 3))</code><br>
+ <code style="padding-left: 20px">(# == 'order' || # == 'order_cancel') && has_all(@usrTypes, list(1, 2, 3))</code><br>
<code>}</code><br>
<code>term(a)=/org.mypackage.MyClass#termMethod/?</code> <sup><small>line 21</small></sup>
</dt>
@@ -355,7 +356,7 @@ id: intent_matching
A term is matched if its token predicate returns true.
The matched term represents one or more tokens, sequential or not, that were detected in the user input. Intent has a list of terms
(always at least one) that all have to be matched in the user input for the intent to match. Note that term
- can be optional if its min quantifier is zero. Whether or not the order of the terms is important
+ can be optional if its min quantifier is zero. Whether the order of the terms is important
for matching is governed by intent's <code>ordered</code> parameter.
</p>
<p>
@@ -479,14 +480,14 @@ id: intent_matching
</p>
<pre class="brush: idl, highlight: [2, 3, 15, 18]">
// Fragments.
- fragment=buzz term~{tok_id() == meta_frag('id')}
+ fragment=buzz term~{# == meta_frag('id')}
fragment=when
term(nums)~{
// Term variable.
@type = meta_tok('nlpcraft:num:unittype')
@iseq = meta_tok('nlpcraft:num:isequalcondition')
- tok_id() == 'nlpcraft:num' && @type == 'datetime' && @iseq == true
+ # == 'nlpcraft:num' && @type == 'datetime' && @iseq == true
}[0,7]
// Intents.
@@ -549,7 +550,7 @@ id: intent_matching
<p></p>
</li>
</ul>
- <h2 class="section-sub-title">Intent Lifecycle <a href="#"><i class="top-link fas fa-fw fa-angle-double-up"></i></a></h2>
+ <h2 id="intent-lifecycle" class="section-sub-title">Intent Lifecycle <a href="#"><i class="top-link fas fa-fw fa-angle-double-up"></i></a></h2>
<p>
During NLPCraft data probe start it scans the models provided in its configuration for the intents. The
scanning process goes through JSON/YAML external configurations as well as model classes when looking
@@ -583,7 +584,7 @@ id: intent_matching
user and company metadata, as well as request data all of which can change at runtime and
are accessible through <a href="#idl_functions">IDL functions.</a>
</p>
- <h2 class="section-sub-title">Intent Examples <a href="#"><i class="top-link fas fa-fw fa-angle-double-up"></i></a></h2>
+ <h2 id="intent-examples" class="section-sub-title">Intent Examples <a href="#"><i class="top-link fas fa-fw fa-angle-double-up"></i></a></h2>
<p>
Here's few of intent examples with explanations:
</p>
@@ -592,8 +593,8 @@ id: intent_matching
</p>
<pre class="brush: idl">
intent=a
- term~{tok_id() == 'x:id'}
- term(nums)~{tok_id() == 'nlpcraft:num' && lowercase(meta_tok('nlpcraft:num:unittype')) == 'datetime'}[0,2]
+ term~{# == 'x:id'}
+ term(nums)~{# == 'nlpcraft:num' && lowercase(meta_tok('nlpcraft:num:unittype')) == 'datetime'}[0,2]
</pre>
<p><b>NOTES:</b></p>
<ul>
@@ -632,8 +633,8 @@ id: intent_matching
<pre class="brush: idl">
intent=id2
flow='id1 id2'
- term={tok_id() == 'mytok' && signum(get(meta_tok('score'), 'best')) != -1}
- term={has_any(tok_groups(), list('actors', 'owners')) && size(meta_part('partAlias, 'text')) > 10}
+ term={# == 'mytok' && signum(get(meta_tok('score'), 'best')) != -1}
+ term={has_any(tok_groups, list('actors', 'owners')) && size(meta_part('partAlias, 'text')) > 10}
</pre>
<p><b>NOTES:</b></p>
<ul>
@@ -743,16 +744,16 @@ id: intent_matching
<code>brush: idl</code> CSS class:
</p>
<pre class="brush: html">
-<pre class="brush: idl">
+<
+ pre class="brush: idl">
intent=xa
flow="^(?:login)(^:logout)*$"
meta={'enabled': true}
- term(a)={month() >= 6 && !(tok_id()) != "z" && meta_intent('enabled') == true}[1,3]
+ term(a)={month >= 6 && # != "z" && meta_intent('enabled') == true}[1,3]
term(b)~{
- @tokId = tok_id()
@usrTypes = meta_model('user_types')
- (tokId == 'order' || tokId == 'order_cancel') && has_all(@usrTypes, list(1, 2, 3))
+ (# == 'order' || # == 'order_cancel') && has_all(@usrTypes, list(1, 2, 3))
}
</pre>
</pre>
@@ -762,15 +763,27 @@ id: intent_matching
<section id="idl_functions" >
<h2 class="section-title">IDL Functions <a href="#"><i class="top-link fas fa-fw fa-angle-double-up"></i></a></h2>
<p>
- IDL provides over 140 built-in functions that can be used in IDL intent definitions.
+ IDL provides over 150 built-in functions that can be used in IDL intent definitions.
IDL function call takes on traditional
- <code><b>fun_name</b>(p1, p2, ... pk)</code> syntax form.
+ <code><b>fun_name</b>(p1, p2, ... pk)</code> syntax form. If function has no parameters, the brackets are optional.
IDL function operates on stack - its parameters
are taken from the stack and its result is put back onto stack which in turn can become a parameter for the next function
- call and so on. IDL functions can have zero or more parameters and always have one result value (i.e. no pure side-effect functions). Some IDL
+ call and so on. IDL functions can have zero or more parameters and always have one result value. Some IDL
functions support variable number of parameters. Note that you cannot define your own functions in IDL - in such
- cases you need to use the term with the user-defined callback method.
+ cases you need to use the term with the <a href="#user-defined-callback">user-defined callback</a> method.
</p>
+ <div class="bq info">
+ <p><b>Special Shorthand <code>#</code></b></p>
+ <p>
+ The frequently used IDL function <code>tok_id()</code> has a special shorthand <code>#</code>. For example,
+ the following expressions are all equal:
+ </p>
+ <pre class="brush: idl">
+ tok_id() == 'id'
+ tok_id == 'id' // Remember - empty parens are optional.
+ # == 'id'
+ </pre>
+ </div>
<p>
When chaining the function
calls IDL uses mathematical notation (a-la Python) rather than object-oriented one: IDL <code>length(trim(" text "))</code> vs. OOP-style <code>" text ".trim().length()</code>.
@@ -1144,7 +1157,7 @@ id: intent_matching
</p>
<pre class="brush: scala, highlight: [1, 2]">
@NCIntent("import('/opt/myproj/global_fragments.idl')") // Importing.
- @NCIntent("intent=act term(act)={has(tok_groups(), 'act')} fragment(f1)") // Defining in place.
+ @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]
@@ -1169,7 +1182,7 @@ id: intent_matching
"intents": [
"import('/opt/myproj/global_fragments.idl')", // Importing.
"import('/opt/myproj/my_intents.idl')", // Importing.
- "intent=alarm term~{tok_id()=='x:alarm'}" // Defining in place.
+ "intent=alarm term~{#=='x:alarm'}" // Defining in place.
]
}
</pre>
@@ -1187,14 +1200,14 @@ id: intent_matching
// Fragments.
// ----------
- fragment=buzz term~{tok_id() == 'x:alarm'}
+ fragment=buzz term~{# == 'x:alarm'}
fragment=when
term(nums)~{
// Term variables.
@type = meta_tok('nlpcraft:num:unittype')
@iseq = meta_tok('nlpcraft:num:isequalcondition')
- tok_id() == 'nlpcraft:num' && @type != 'datetime' && @iseq == true
+ # == 'nlpcraft:num' && @type != 'datetime' && @iseq == true
}[0,7]
// Intents.
@@ -1401,7 +1414,7 @@ id: intent_matching
}
],
"intents": [
- "intent=alarm term~{tok_id()=='x:alarm'} term(nums)~{tok_id() == 'nlpcraft:num' && meta_tok('nlpcraft:num:unittype') == 'datetime' && meta_tok('nlpcraft:num:isequalcondition') == true}[0,7]"
+ "intent=alarm term~{# == 'x:alarm'} term(nums)~{# == 'nlpcraft:num' && meta_tok('nlpcraft:num:unittype') == 'datetime' && meta_tok('nlpcraft:num:isequalcondition') == true}[0,7]"
]
}
</pre>
@@ -1660,7 +1673,7 @@ id: intent_matching
For example:
</p>
<pre class="brush: java">
- @NCIntent("intent=id term(termId)~{tok_id() == 'my_token'}?")
+ @NCIntent("intent=id term(termId)~{# == 'my_token'}?")
private NCResult onMatch(
@NCIntentTerm("termId") Optional<NCToken> myTok
) {
@@ -1853,6 +1866,9 @@ id: intent_matching
<li class="side-nav-title">On This Page</li>
<li><a href="#intent">Overview</a></li>
<li><a href="#idl">IDL Syntax</a></li>
+ <li><a class="toc2" href="#intent-lifecycle">Intent Lifecycle</a></li>
+ <li><a class="toc2" href="#intent-examples">Intent Examples</a></li>
+ <li><a class="toc2" href="#syntax_highlighting">Syntax Highlighting</a></li>
<li><a href="#idl_functions">IDL Functions</a></li>
<li><a href="#idl_location">IDL Location</a></li>
<li><a href="#binding">Intent Binding</a></li>
diff --git a/short-term-memory.html b/short-term-memory.html
index c70973d..22a4eea 100644
--- a/short-term-memory.html
+++ b/short-term-memory.html
@@ -385,10 +385,10 @@ id: short_term_memory
have the following 4 intents:
</p>
<ul>
- <li><code>id=sale term={tok_id() == 'sale'}</code></li>
- <li><code>id=best_sale_person term={tok_id() == 'sale'} term={tok_id() == best_employee}</code></li>
- <li><code>id=buy term={tok_id() == 'buy'}</code></li>
- <li><code>id=buy_best_person term={tok_id() == 'buy'} term={tok_id() == best_employee}</code></li>
+ <li><code>id=sale term={# == 'sale'}</code></li>
+ <li><code>id=best_sale_person term={# == 'sale'} term={# == best_employee}</code></li>
+ <li><code>id=buy term={# == 'buy'}</code></li>
+ <li><code>id=buy_best_person term={# == 'buy'} term={# == best_employee}</code></li>
</ul>
<p>
(this is actual <a href="/intent-matching.html">Intent Definition Language</a> (IDL) used by NLPCraft -