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 2020/09/22 18:58:46 UTC

[incubator-nlpcraft] branch master updated (fc77832 -> 4ed496b)

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

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


    from fc77832  User data added to conversation.
     new e68cafb  WIP.
     new 57aaf67  Merge branch 'master' of https://github.com/apache/incubator-nlpcraft
     new 4ed496b  WIP.

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../scala/org/apache/nlpcraft/model/NCConversation.java  | 13 +++++++++----
 .../probe/mgrs/conversation/NCConversation.scala         |  2 +-
 .../probe/mgrs/conversation/NCConversationManager.scala  |  2 +-
 .../probe/mgrs/nlp/NCProbeEnrichmentManager.scala        |  2 +-
 .../model/conversation/NCConversationTimeoutSpec.scala   | 16 ++++++++--------
 5 files changed, 20 insertions(+), 15 deletions(-)


[incubator-nlpcraft] 03/03: WIP.

Posted by ar...@apache.org.
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

commit 4ed496b341f3737954666f6a6a13563c6e6e3159
Author: Aaron Radzinski <ar...@datalingvo.com>
AuthorDate: Tue Sep 22 11:58:35 2020 -0700

    WIP.
---
 .../probe/mgrs/conversation/NCConversationManager.scala  |  2 +-
 .../model/conversation/NCConversationTimeoutSpec.scala   | 16 ++++++++--------
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/conversation/NCConversationManager.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/conversation/NCConversationManager.scala
index d31d4b3..45812ed 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/conversation/NCConversationManager.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/conversation/NCConversationManager.scala
@@ -95,7 +95,7 @@ object NCConversationManager extends NCService {
                     }
 
                 if (del) {
-                    value.conv.getData.clear()
+                    value.conv.getUserData.clear()
 
                     delKeys += key
                 }
diff --git a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/conversation/NCConversationTimeoutSpec.scala b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/conversation/NCConversationTimeoutSpec.scala
index c94ba26..fb042c5 100644
--- a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/conversation/NCConversationTimeoutSpec.scala
+++ b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/conversation/NCConversationTimeoutSpec.scala
@@ -60,26 +60,26 @@ class NCTimeoutSpecModel extends NCModel {
 
         step match {
             case 0 ⇒
-                assertTrue(conv.getData.isEmpty)
+                assertTrue(conv.getUserData.isEmpty)
                 assertTrue(conv.getDialogFlow.isEmpty)
 
-                conv.getData.put("key", "value")
+                conv.getUserData.put("key", "value")
 
-                saveData = conv.getData
+                saveData = conv.getUserData
 
             case 1 ⇒
-                assertFalse(conv.getData.isEmpty)
-                assertEquals(saveData, conv.getData)
-                assertEquals("value", conv.getData.getOrDefault("key", "-"))
+                assertFalse(conv.getUserData.isEmpty)
+                assertEquals(saveData, conv.getUserData)
+                assertEquals("value", conv.getUserData.getOrDefault("key", "-"))
                 assertFalse(conv.getDialogFlow.isEmpty)
 
             case 2 ⇒
-                assertTrue(conv.getData.isEmpty)
+                assertTrue(conv.getUserData.isEmpty)
                 assertTrue(saveData.isEmpty)
                 assertTrue(conv.getDialogFlow.isEmpty)
 
             case 3 ⇒
-                assertTrue(conv.getData.isEmpty)
+                assertTrue(conv.getUserData.isEmpty)
                 assertFalse(conv.getDialogFlow.isEmpty)
 
             case _ ⇒ require(false)


[incubator-nlpcraft] 02/03: Merge branch 'master' of https://github.com/apache/incubator-nlpcraft

Posted by ar...@apache.org.
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

commit 57aaf678ead4c570be2dcac866dbc5877d1e60ab
Merge: e68cafb fc77832
Author: Aaron Radzinski <ar...@datalingvo.com>
AuthorDate: Tue Sep 22 11:57:47 2020 -0700

    Merge branch 'master' of https://github.com/apache/incubator-nlpcraft

 nlpcraft/src/main/resources/nlpcraft.conf          |  12 ---
 .../probe/mgrs/conversation/NCConversation.scala   |   9 +-
 .../mgrs/conversation/NCConversationManager.scala  |  92 ++++++++++-------
 .../mgrs/dialogflow/NCDialogFlowManager.scala      | 103 ++++++++++--------
 .../conversation/NCConversationTimeoutSpec.scala   | 115 +++++++++++++++++++++
 5 files changed, 235 insertions(+), 96 deletions(-)



[incubator-nlpcraft] 01/03: WIP.

Posted by ar...@apache.org.
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

commit e68cafbf0b1f361791b8ded38a39a2588a89edc5
Author: Aaron Radzinski <ar...@datalingvo.com>
AuthorDate: Tue Sep 22 11:56:57 2020 -0700

    WIP.
---
 .../scala/org/apache/nlpcraft/model/NCConversation.java     | 13 +++++++++++++
 .../nlpcraft/probe/mgrs/conversation/NCConversation.scala   |  5 +++++
 .../nlpcraft/probe/mgrs/nlp/NCProbeEnrichmentManager.scala  |  1 +
 3 files changed, 19 insertions(+)

diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCConversation.java b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCConversation.java
index 5655426..b990851 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCConversation.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCConversation.java
@@ -18,6 +18,7 @@
 package org.apache.nlpcraft.model;
 
 import java.util.List;
+import java.util.Map;
 import java.util.function.Predicate;
 
 /**
@@ -83,4 +84,16 @@ public interface NCConversation {
      * @param filter Dialog flow filter based on IDs of previously matched intents.
      */
     void clearDialog(Predicate<String/* Intent ID. */> filter);
+
+    /**
+     * Gets modifiable user data container that can be to store user data in the conversation.
+     * Note that this data will expire the same as other elements in the conversation (i.e. tokens and
+     * previously matched intents).
+     * <p>
+     * Note that you should obtain the user data container on every intent callback invocation to make
+     * sure that expiration policy takes an effect. Do not cache the returned object elsewhere.
+     *
+     * @return Mutable user data container. The returned map is safe for concurrent modifications.
+     */
+    Map<String, Object> getUserData();
 }
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/conversation/NCConversation.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/conversation/NCConversation.scala
index 1f8f51b..21c17a7 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/conversation/NCConversation.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/conversation/NCConversation.scala
@@ -278,4 +278,9 @@ case class NCConversation(
             new util.ArrayList[NCToken](toks.asJava)
         }
     }
+
+    /**
+      *
+      */
+    def getUserData: util.Map[String, Object] = data
 }
\ No newline at end of file
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/nlp/NCProbeEnrichmentManager.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/nlp/NCProbeEnrichmentManager.scala
index e40e5ac..3e6ff92 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/nlp/NCProbeEnrichmentManager.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/mgrs/nlp/NCProbeEnrichmentManager.scala
@@ -563,6 +563,7 @@ object NCProbeEnrichmentManager extends NCService with NCOpenCensusModelStats {
                 override def getDialogFlow: util.List[String] = NCDialogFlowManager.getDialogFlow(usrId, mdlId, span).asJava
                 override def clearStm(filter: Predicate[NCToken]): Unit = conv.clearTokens(filter)
                 override def clearDialog(filter: Predicate[String]): Unit = NCDialogFlowManager.clear(usrId, mdlId, span)
+                override def getUserData: util.Map[String, Object] = conv.getUserData
             }
 
             override def isOwnerOf(tok: NCToken): Boolean = allVars.contains(tok)