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

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


The following commit(s) were added to refs/heads/NLPCRAFT-151 by this push:
     new 67cad42  Fix for NLPCRAFT-151.
67cad42 is described below

commit 67cad42d26b837fbbc29a249408e548a26a5a845
Author: Aaron Radzinski <[email protected]>
AuthorDate: Wed Oct 14 10:50:30 2020 -0700

    Fix for NLPCRAFT-151.
---
 .../org/apache/nlpcraft/examples/weather/WeatherModel.java  | 13 ++++++++++++-
 .../org/apache/nlpcraft/examples/weather/weather_model.json | 10 ++++++++++
 .../nlpcraft/model/tools/test/NCTestAutoModelValidator.java |  7 ++++++-
 3 files changed, 28 insertions(+), 2 deletions(-)

diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/weather/WeatherModel.java
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/weather/WeatherModel.java
index 2c78e70..872cb03 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/weather/WeatherModel.java
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/weather/WeatherModel.java
@@ -125,11 +125,22 @@ public class WeatherModel extends NCModelFileAdapter {
     @NCIntent(
         "intent=req " +
         "conv=true " + // Support conversation context (i.e. short term 
memory).
-        "term={id == 'wt:phen'}+ " + // One or more weather phenomenon (at 
least is mandatory).
+        "term={id == 'wt:phen'}* " + // Zero or more weather phenomenon.
         "term(ind)={groups @@ 'indicator'}* " + // Optional indicator words 
(zero or more).
         "term(city)={id == 'nlpcraft:city'}? " + // Optional city.
         "term(date)={id == 'nlpcraft:date'}?" // Optional date (overrides 
indicator words).
     )
+    // NOTE: each samples group will reset conversation STM.
+    @NCIntentSample({
+        "Current forecast?",
+        "Chance of rain in Berlin now?"
+    })
+    // NOTE: each samples group will reset conversation STM.
+    @NCIntentSample({
+        "Moscow forecast?",
+        "Chicago history"
+    })
+    // NOTE: each samples group will reset conversation STM.
     @NCIntentSample({
         "What's the local weather forecast?",
         "What's the weather in Moscow?",
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/weather/weather_model.json
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/weather/weather_model.json
index b5d6577..4eee3ee 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/weather/weather_model.json
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/examples/weather/weather_model.json
@@ -42,6 +42,16 @@
       ]
     },
     {
+      "id": "wt:curr",
+      "description": "Current indicator.",
+      "groups": [
+        "indicator"
+      ],
+      "synonyms": [
+        "{current|today|now|right now}"
+      ]
+    },
+    {
       "id": "wt:fcast",
       "description": "Forecast (future) indicator.",
       "groups": [
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/test/NCTestAutoModelValidator.java
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/test/NCTestAutoModelValidator.java
index 1f15ff5..453e34e 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/test/NCTestAutoModelValidator.java
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/test/NCTestAutoModelValidator.java
@@ -28,7 +28,12 @@ import java.util.*;
  * sentences from {@link NCIntentSample} annotation and checking that 
resulting intent matches the intent the sample
  * was attached to.
  * <p>
- * Note that this class can be used in two modes:
+ * Note that there can be more than one {@link NCIntentSample} annotation 
attached to the intent callback. Each such
+ * annotation will trigger conversation STM reset before its samples will be 
submitted. This gives an opportunity
+ * to test samples both with and without conversational context as well as the 
same sample but with multiple different
+ * conversation contexts.
+ * <p>
+ * This class can be used in two modes:
  * <ul>
  *     <li>
  *         As a standalone application supplying model classes using 
<code>NLPCRAFT_TEST_MODELS</code> system property.

Reply via email to