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/07/18 22:27:35 UTC

[incubator-nlpcraft] branch master updated: Improved Javadoc.

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 4c6cfcc  Improved Javadoc.
4c6cfcc is described below

commit 4c6cfcc9b2e02a974ea1ba5e4ce96f1d885f80dd
Author: Aaron Radzinski <ar...@datalingvo.com>
AuthorDate: Sun Jul 18 15:27:27 2021 -0700

    Improved Javadoc.
---
 .../scala/org/apache/nlpcraft/model/NCIntent.java    | 20 +++++++++++++++++++-
 .../scala/org/apache/nlpcraft/model/NCIntentRef.java | 14 +++++++++++++-
 .../org/apache/nlpcraft/model/NCIntentSample.java    |  2 +-
 .../org/apache/nlpcraft/model/NCIntentSampleRef.java |  2 +-
 .../org/apache/nlpcraft/model/NCIntentTerm.java      | 20 +++++++++++++++++++-
 5 files changed, 53 insertions(+), 5 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 5900bf3..877f7d7 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCIntent.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCIntent.java
@@ -29,7 +29,25 @@ import static java.lang.annotation.RetentionPolicy.*;
  * 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
+ * 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: [1,2]">
+ * {@literal @}NCIntent("import('intents.idl')")
+ * {@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.",
+ *     "Get the lights on.",
+ *     "Please, put the light out in the upstairs bedroom."
+ * ))
+ * def onMatch(
+ *     {@literal @}NCIntentTerm("act") actTok: NCToken,
+ *     {@literal @}NCIntentTerm("loc") locToks: List[NCToken]
+ * ): NCResult = {
+ *     ...
+ * }
+ * </pre>
+ * <p>
+ * Read full documentation in <a target=_ href="https://nlpcraft.apache.org/intent-matching.html#binding">Intent Matching</a> section and review
  * <a target=_ href="https://github.com/apache/incubator-nlpcraft/tree/master/nlpcraft-examples">examples</a>.
  *
  * @see NCIntentRef
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 7b8c481..263f09f 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCIntentRef.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCIntentRef.java
@@ -27,7 +27,19 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
  * 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
+ * Here's an example of using this annotation (from <a target=_new href="https://nlpcraft.apache.org/examples/alarm_clock.html">Alarm Clock</a> example):
+ * <pre class="brush: java, highlight: [1]">
+ * {@literal @}NCIntentRef("alarm")
+ * {@literal @}NCIntentSampleRef("alarm_samples.txt")
+ *      NCResult onMatch(
+ *      NCIntentMatch ctx,
+ *      {@literal @}NCIntentTerm("nums") List&lt;NCToken&gt; numToks
+ * ) {
+ *     ...
+ * }
+ * </pre>
+ * <p>
+ * Read full documentation in <a target=_ href="https://nlpcraft.apache.org/intent-matching.html#binding">Intent Matching</a> section and review
  * <a target=_ href="https://github.com/apache/incubator-nlpcraft/tree/master/nlpcraft-examples">examples</a>.
  *
  * @see NCIntent
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 f3ec645..e8d18c7 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCIntentSample.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCIntentSample.java
@@ -69,7 +69,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
  * }
  * </pre>
  * <p>
- * Read full documentation in <a target=_ href="https://nlpcraft.apache.org/intent-matching.html">Intent Matching</a> section and review
+ * Read full documentation in <a target=_ href="https://nlpcraft.apache.org/intent-matching.html#binding">Intent Matching</a> section and review
  * <a target=_ href="https://github.com/apache/incubator-nlpcraft/tree/master/nlpcraft-examples">examples</a>.
  *
  * @see NCIntentSampleRef
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCIntentSampleRef.java b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCIntentSampleRef.java
index 63cbf25..2596611 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCIntentSampleRef.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCIntentSampleRef.java
@@ -68,7 +68,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
  * }
  * </pre>
  * <p>
- * Read full documentation in <a target=_ href="https://nlpcraft.apache.org/intent-matching.html">Intent Matching</a> section and review
+ * Read full documentation in <a target=_ href="https://nlpcraft.apache.org/intent-matching.html#binding">Intent Matching</a> section and review
  * <a target=_ href="https://github.com/apache/incubator-nlpcraft/tree/master/nlpcraft-examples">examples</a>.
  *
  * @see NCIntentSample
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 9d6a16c..e864eb5 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCIntentTerm.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCIntentTerm.java
@@ -33,7 +33,25 @@ import static java.lang.annotation.RetentionPolicy.*;
  * 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
+ * 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: [10,11]">
+ * {@literal @}NCIntent("import('intents.idl')")
+ * {@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.",
+ *     "Get the lights on.",
+ *     "Please, put the light out in the upstairs bedroom."
+ * ))
+ * def onMatch(
+ *     {@literal @}NCIntentTerm("act") actTok: NCToken,
+ *     {@literal @}NCIntentTerm("loc") locToks: List[NCToken]
+ * ): NCResult = {
+ *     ...
+ * }
+ * </pre>
+ * <p>
+ * Read full documentation in <a target=_ href="https://nlpcraft.apache.org/intent-matching.html#binding">Intent Matching</a> section and review
  * <a target=_ href="https://github.com/apache/incubator-nlpcraft/tree/master/nlpcraft-examples">examples</a>.
  *
  * @see NCIntent