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/21 05:24:19 UTC

[incubator-nlpcraft] branch master updated: Added dialog flow access API to context.

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 02e5eb4  Added dialog flow access API to context.
02e5eb4 is described below

commit 02e5eb444cb1beb638074c4c01b62f283ccd862d
Author: Aaron Radzinski <ar...@datalingvo.com>
AuthorDate: Sun Sep 20 22:24:06 2020 -0700

    Added dialog flow access API to context.
---
 .../src/main/scala/org/apache/nlpcraft/model/NCConversation.java    | 6 ++++++
 nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCCustomWord.java | 2 +-
 nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCRequest.java    | 4 ++--
 .../apache/nlpcraft/probe/mgrs/nlp/NCProbeEnrichmentManager.scala   | 1 +
 4 files changed, 10 insertions(+), 3 deletions(-)

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 b56137d..38b3e04 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCConversation.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCConversation.java
@@ -49,6 +49,12 @@ public interface NCConversation {
     List<NCToken> getTokens();
 
     /**
+     * Gets IDs for the previously matched intents sorted from oldest to newest for the current
+     * user and data model.
+     */
+    List<String> getDialogFlow();
+
+    /**
      * Removes all tokens satisfying given predicate from the conversation STM.
      * This is particularly useful when the logic processing the user input makes an implicit
      * assumption not present in the user input itself. Such assumption may alter the conversation (without
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCCustomWord.java b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCCustomWord.java
index 3e6b3b1..03ed3b0 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCCustomWord.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCCustomWord.java
@@ -54,7 +54,7 @@ public interface NCCustomWord {
 
     /**
      * Gets Penn Treebank POS tag for this word. Note that additionally to standard Penn Treebank POS
-     * tags NLPCraft introduces {@code '---'} synthetic tag to indicate a POS tag for multiword part.
+     * tags NLPCraft introduces {@code '---'} synthetic tag to indicate a POS tag for multi-word part.
      * Learn more at <a href="http://www.ling.upenn.edu/courses/Fall_2003/ling001/penn_treebank_pos.html">http://www.ling.upenn.edu/courses/Fall_2003/ling001/penn_treebank_pos.html</a>
      *
      * @return Penn Treebank POS tag for this word.
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCRequest.java b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCRequest.java
index 5082343..ffb91fb 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCRequest.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCRequest.java
@@ -43,8 +43,8 @@ public interface NCRequest {
      * Gets globally unique server ID of the current request.
      * <p>
      * Server request is defined as a processing of a one user input request (a session).
-     * Note that model can be accessed multiple times during processing of a single user request
-     * and therefor multiple instances of this interface can return the same server
+     * Note that the model can be accessed multiple times during processing of a single user request
+     * and therefore multiple instances of this interface can return the same server
      * request ID. In fact, users of this interfaces can use this fact by using this ID,
      * for example, as a map key for a session scoped storage.
      *
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 d96cd7d..e40e5ac 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
@@ -560,6 +560,7 @@ object NCProbeEnrichmentManager extends NCService with NCOpenCensusModelStats {
 
             override lazy val getConversation: NCConversation = new NCConversation {
                 override def getTokens: util.List[NCToken] = conv.getTokens()
+                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)
             }