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

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


The following commit(s) were added to refs/heads/NLPCRAFT-206 by this push:
     new 5a96e72  WIP.
5a96e72 is described below

commit 5a96e728b77d4e35dde29dd3e30fededc02f7b16
Author: Aaron Radzinski <[email protected]>
AuthorDate: Fri Mar 12 21:20:20 2021 -0800

    WIP.
---
 nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCIntent.java    | 7 +++++--
 nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCIntentRef.java | 4 +++-
 .../src/main/scala/org/apache/nlpcraft/model/NCIntentSample.java   | 2 +-
 .../src/main/scala/org/apache/nlpcraft/model/NCIntentTerm.java     | 7 +++++--
 4 files changed, 14 insertions(+), 6 deletions(-)

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 898be67..14ecc1d 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCIntent.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCIntent.java
@@ -23,8 +23,11 @@ import static java.lang.annotation.ElementType.*;
 import static java.lang.annotation.RetentionPolicy.*;
 
 /**
- * Annotation to define an intent on the method serving as its callback. This 
annotation takes a string value
- * that defines an intent via intent DSL.
+ * Annotation to bind an intent with the method serving as its callback. This 
annotation takes a string value
+ * that defines an intent via intent DSL. This annotation can also be applied 
to a model's class in
+ * which case it will just declare the intent without binding it and the 
callback method will need to
+ * use {@link NCIntentRef} annotation to actually bind it to the declared 
intent. Note that multiple intents
+ * can be bound to the same callback method, but only one callback method can 
be bound with a given intent.
  * <p>
  * Read full documentation in <a target=_ 
href="https://nlpcraft.apache.org/intent-matching.html";>Intent Matching</a> 
section and review
  * <a target=_ 
href="https://github.com/apache/incubator-nlpcraft/tree/master/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/";>examples</a>.
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCIntentRef.java 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCIntentRef.java
index cc0952a..af231f1 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCIntentRef.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCIntentRef.java
@@ -23,7 +23,9 @@ import static java.lang.annotation.ElementType.METHOD;
 import static java.lang.annotation.RetentionPolicy.RUNTIME;
 
 /**
- * Annotations referencing an intent defined externally in JSON or YAML model 
declaration.
+ * Annotations referencing an intent defined outside of callback method 
declaration. Multiple such annotations
+ * can be applied to the callback method. Note that multiple intents can be 
bound to the same callback method,
+ * but only one callback method can be bound with a given intent.
  * <p>
  * Read full documentation in <a target=_ 
href="https://nlpcraft.apache.org/intent-matching.html";>Intent Matching</a> 
section and review
  * <a target=_ 
href="https://github.com/apache/incubator-nlpcraft/tree/master/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/";>examples</a>.
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 4211f45..7a97a01 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)={groups {@literal @}{@literal @} 
'act'} term(loc)={trim(id) == 'ls:loc'}*")
+ * {@literal @}NCIntent("intent=act term(act)={has(groups(), 'act')} 
term(loc)={trim(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/main/scala/org/apache/nlpcraft/model/NCIntentTerm.java 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCIntentTerm.java
index 774c4b0..7052e5f 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCIntentTerm.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCIntentTerm.java
@@ -30,6 +30,9 @@ import static java.lang.annotation.RetentionPolicy.*;
  * method parameters to get the tokens associated with that term (if and when 
the intent was matched and that
  * callback was invoked).
  * <p>
+ * Note that if multiple intents bound to the same callback method, all such 
intents should have the named
+ * terms specified by this annotation.
+ * <p>
  * Read full documentation in <a target=_ 
href="https://nlpcraft.apache.org/intent-matching.html";>Intent Matching</a> 
section and review
  * <a target=_ 
href="https://github.com/apache/incubator-nlpcraft/tree/master/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/";>examples</a>.
  *
@@ -45,9 +48,9 @@ import static java.lang.annotation.RetentionPolicy.*;
 @Target(value=PARAMETER)
 public @interface NCIntentTerm {
     /**
-     * ID of the intent defined externally.
+     * ID of the intent term.
      *
-     * @return ID of the intent defined externally.
+     * @return ID of the intent term.
      */
     String value();
 }

Reply via email to