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 58728ae  WIP.
58728ae is described below

commit 58728ae5f5aa8b20804595aaf0daf2995c79fc69
Author: Aaron Radzinski <[email protected]>
AuthorDate: Wed Dec 8 15:12:50 2021 -0800

    WIP.
---
 .../main/scala/org/apache/nlpcraft/NCContext.java  |  9 +++
 .../org/apache/nlpcraft/NCDialogFlowItem.java      | 18 ++++++
 .../scala/org/apache/nlpcraft/NCIntentMatch.java   | 64 ++++++++++++++++++++++
 3 files changed, 91 insertions(+)

diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCContext.java 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCContext.java
index 31832ad..f560672 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCContext.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCContext.java
@@ -17,6 +17,9 @@
 
 package org.apache.nlpcraft;
 
+import java.util.Collection;
+import java.util.List;
+
 /**
  *
  */
@@ -49,4 +52,10 @@ public interface NCContext {
      * @return Current conversation.
      */
     NCConversation getConversation();
+
+    /**
+     *
+     * @return
+     */
+    Collection<List<NCEntity>> getVariants();
 }
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCDialogFlowItem.java 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCDialogFlowItem.java
index 5abe931..f5519e3 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCDialogFlowItem.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCDialogFlowItem.java
@@ -21,4 +21,22 @@ package org.apache.nlpcraft;
  *
  */
 public interface NCDialogFlowItem {
+    /**
+     *
+     * @return
+     */
+    NCIntentMatch getIntentMatch();
+
+    /**
+     *
+     * @return
+     */
+    NCRequest getRequest();
+
+    /**
+     * Gets the winning intent's result.
+     *
+     * @return Winning intent's result.
+     */
+    NCResult getResult();
 }
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCIntentMatch.java 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCIntentMatch.java
index 7aa3638..d169400 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCIntentMatch.java
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCIntentMatch.java
@@ -17,8 +17,72 @@
 
 package org.apache.nlpcraft;
 
+import java.util.List;
+
 /**
  *
  */
 public interface NCIntentMatch {
+    /**
+     * Gets ID of the matched intent.
+     *
+     * @return ID of the matched intent.
+     */
+    String getIntentId();
+
+    /**
+     * Gets context of the user request.
+     *
+     * @return Original query context.
+     */
+    NCContext getContext();
+
+    /**
+     * Gets a subset of entities representing matched intent. This subset is 
grouped by the matched terms
+     * where a {@code null} sub-list defines an optional term. Order and index 
of sub-lists corresponds
+     * to the order and index of terms in the matching intent. Number of 
sub-lists will always be the same
+     * as the number of terms in the matched intent.
+     * <p>
+     * Consider using {@link NCIntentTerm} annotation instead for simpler 
access to intent entities.
+     *
+     * @return List of list of entities representing matched intent.
+     * @see #getVariant()
+     * @see NCIntentTerm
+     */
+    List<List<NCEntity>> getIntentEntities();
+
+    /**
+     * Gets entities for given term. This is a companion method for {@link 
#getIntentEntities()}.
+     * <p>
+     * Consider using {@link NCIntentTerm} annotation instead for simpler 
access to intent entities.
+     *
+     * @param idx Index of the term (starting from <code>0</code>).
+     * @return List of entities, potentially {@code null}, for given term.
+     * @see NCIntentTerm
+     * @see #getTermEntities(String)
+     */
+    List<NCEntity> getTermEntities(int idx);
+
+    /**
+     * Gets entities for given term. This is a companion method for {@link 
#getIntentEntities()}.
+     * <p>
+     * Consider using {@link NCIntentTerm} annotation instead for simpler 
access to intent entities.
+     *
+     * @param termId ID of the term for which to get entities.
+     * @return List of entities, potentially {@code null}, for given term.
+     * @see NCIntentTerm
+     * @see #getTermEntities(int)
+     */
+    List<NCEntity> getTermEntities(String termId);
+
+    /**
+     * Gets parsing variant that produced the matching for this intent. 
Returned variant is one of the
+     * variants provided by {@link NCContext#getVariants()} methods. Note that 
entities returned by this method are
+     * a superset of the entities returned by {@link #getIntentEntities()}  
method, i.e. not all entities
+     * from this variant may have been used in matching of the winning intent.
+     *
+     * @return Parsing variant that produced the matching for this intent.
+     * @see #getIntentEntities()
+     */
+    List<NCEntity> getVariant();
 }

Reply via email to