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.git


The following commit(s) were added to refs/heads/master by this push:
     new 637b79a  WIP.
637b79a is described below

commit 637b79a4376d60ae78c60861142dbe8ec5f25c69
Author: Aaron Radzinzski <[email protected]>
AuthorDate: Sun Apr 18 01:51:45 2021 +0300

    WIP.
---
 .../main/scala/org/apache/nlpcraft/model/NCToken.java  | 18 ++++++++++--------
 .../model/intent/compiler/NCIdlCompilerBase.scala      |  3 +--
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCToken.java 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCToken.java
index bdf7fe9..22dad76 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCToken.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCToken.java
@@ -72,7 +72,7 @@ public interface NCToken extends NCMetadata {
 
     /**
      * Gets the optional parent ID of the model element this token represents. 
This only available
-     * for user-defined model elements (built-in tokens do not have parents).
+     * for user-defined model elements - built-in tokens do not have parents 
and this will return {@code null}.
      *
      * @return ID of the token's element immediate parent or {@code null} if 
not available.
      * @see NCElement#getParentId()
@@ -82,7 +82,7 @@ public interface NCToken extends NCMetadata {
 
     /**
      * Gets the list of all parent IDs from this token up to the root. This 
only available
-     * for user-defined model elements (built-in tokens do not have parents).
+     * for user-defined model elements = built-in tokens do not have parents 
and will return an empty list.
      *
      * @return List, potentially empty but never {@code null}, of all parent 
IDs from this token up to the root.
      * @see #getParentId()
@@ -182,8 +182,8 @@ public interface NCToken extends NCMetadata {
 
     /**
      * Gets the value if this token was detected via element's value (or its 
synonyms). Otherwise
-     * returns {@code null}. Only applicable for user-defined model elements 
(built-in tokens
-     * do not have values).
+     * returns {@code null}. Only applicable for user-defined model elements - 
built-in tokens
+     * do not have values and it will return {@code null}.
      * 
      * @return Value for the user-defined model element or {@code null}, if 
not available.
      * @see NCElement#getValues()
@@ -191,8 +191,8 @@ public interface NCToken extends NCMetadata {
     String getValue();
 
     /**
-     * Gets the list of groups this token belongs to. By default, if not 
specified explicitly, the group
-     * is token's ID.
+     * Gets the list of groups this token belongs to. Note that, by default, 
if not specified explicitly,
+     * token always belongs to one group with ID equal to token ID.
      *
      * @return Token groups list. Never {@code null} - but can be empty.
      * @see NCElement#getGroups()
@@ -239,6 +239,8 @@ public interface NCToken extends NCMetadata {
      * See more information on token metadata <a target=_ 
href="https://nlpcraft.apache.org/data-model.html#meta";>here</a>.
      * 
      * @return Whether or not this token is a stopword.
+     * @see NCModelView#getAdditionalStopWords()
+     * @see NCModelView#getExcludedStopWords()
      */
     default boolean isStopWord() {
         return meta("nlpcraft:nlp:stopword");
@@ -473,9 +475,9 @@ public interface NCToken extends NCMetadata {
     }
 
     /**
-     * Tests whether or not this token is a user-defined token.
+     * Tests whether or not this token is for a user-defined model element.
      *
-     * @return {@code True} if this token is defined by the model element in 
the user model, {@code false} otherwise.
+     * @return {@code True} if this token is defined by the user model 
element, {@code false} otherwise.
      */
     default boolean isUserDefined() {
         String id = getId();
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/compiler/NCIdlCompilerBase.scala
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/compiler/NCIdlCompilerBase.scala
index 9ac0234..96d0cdf 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/compiler/NCIdlCompilerBase.scala
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/intent/compiler/NCIdlCompilerBase.scala
@@ -998,7 +998,6 @@ trait NCIdlCompilerBase {
                     s"]")
             else
                 parts.get(0)
-
         }
 
         //noinspection DuplicatedCode
@@ -1112,7 +1111,7 @@ trait NCIdlCompilerBase {
             case "tok_parent" ⇒ arg1Tok() match { case x ⇒ stack.push(() ⇒ { 
Z(toToken(x().value).getParentId, 1) }) }
             case "tok_groups" ⇒ arg1Tok() match { case x ⇒ stack.push(() ⇒ { 
Z(toToken(x().value).getGroups, 1) }) }
             case "tok_value" ⇒ arg1Tok() match { case x ⇒ stack.push(() ⇒ { 
Z(toToken(x().value).getValue, 1) }) }
-            case "tok_aliases" ⇒ arg1Tok() match { case x ⇒ stack.push(() ⇒ { 
Z(toToken(x().value).getAliases, 1) }) }
+            case "tok_aliases" ⇒ arg1Tok() match { case x ⇒ stack.push(() ⇒ { 
Z(new java.util.ArrayList[String](toToken(x().value).getAliases), 1) }) }
             case "tok_start_idx" ⇒ arg1Tok() match { case x ⇒ stack.push(() ⇒ 
{ Z(toToken(x().value).getStartCharIndex, 1) }) }
             case "tok_end_idx" ⇒ arg1Tok() match { case x ⇒ stack.push(() ⇒ { 
Z(toToken(x().value).getEndCharIndex, 1) }) }
             case "tok_this" ⇒ z0(() ⇒ Z(tok, 1))

Reply via email to