Package org.apache.nlpcraft.model
Interface NCDialogFlowItem
-
- All Superinterfaces:
NCMetadata
public interface NCDialogFlowItem extends NCMetadata
An item of the dialog flow. Dialog flow is a chronologically ordered list of dialog flow items. Each item represents a snapshot of winning intent's match and its associated data. List of instances of this interface is passed into a custom user-defined dialog flow match method.Read full documentation in Intent Matching section and review examples.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Optional<String>
getClientAgent()
Gets string representation of the user client agent that made the initial REST request .NCCompany
getCompany()
Gets descriptor of the user's company on behalf of which the input request was submitted.String
getIntentId()
Gets ID of the matched intent.List<List<NCToken>>
getIntentTokens()
Gets a subset of tokens representing matched intent.String
getNormalizedText()
Gets normalized text of the user input.long
getReceiveTimestamp()
Gets UTC/GMT timestamp in milliseconds when user input was received.Optional<String>
getRemoteAddress()
Gets optional address of the remote client that made the initial REST request.Map<String,Object>
getRequestData()
Gets optional JSON data passed in with the user request.NCResult
getResult()
Gets the winning intent's callback result.String
getServerRequestId()
Gets globally unique server ID of the input request.List<NCToken>
getTermTokens(int idx)
Gets tokens for given term.List<NCToken>
getTermTokens(String termId)
Gets tokens for given term.NCUser
getUser()
Gets descriptor of the user on behalf of which the input request was submitted.NCVariant
getVariant()
Gets sentence parsing variant that produced the matching for the winning intent.-
Methods inherited from interface org.apache.nlpcraft.model.NCMetadata
getMetadata, meta, meta, metaOpt, metax
-
-
-
-
Method Detail
-
getIntentId
String getIntentId()
Gets ID of the matched intent.- Returns:
- ID of the matched intent.
-
getResult
NCResult getResult()
Gets the winning intent's callback result.- Returns:
- Winning intent's callback result.
-
getIntentTokens
List<List<NCToken>> getIntentTokens()
Gets a subset of tokens representing matched intent. This subset is grouped by the matched terms where anull
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.Note that unlike
getVariant()
method this method returns only subset of the tokens that were part of the matched intent. Specifically, it will not return tokens for free words, stopwords or unmatched ("dangling") tokens.- Returns:
- List of list of tokens representing matched intent.
- See Also:
getVariant()
-
getTermTokens
List<NCToken> getTermTokens(int idx)
Gets tokens for given term. This is a companion method forgetIntentTokens()
.- Parameters:
idx
- Index of the term (starting from0
).- Returns:
- List of tokens, potentially
null
, for given term. - See Also:
NCIntentTerm
,getTermTokens(String)
-
getTermTokens
List<NCToken> getTermTokens(String termId)
Gets tokens for given term. This is a companion method forgetIntentTokens()
.- Parameters:
termId
- ID of the term for which to get tokens.- Returns:
- List of tokens, potentially
null
, for given term. - See Also:
NCIntentTerm
,getTermTokens(int)
-
getVariant
NCVariant getVariant()
Gets sentence parsing variant that produced the matching for the winning intent. Returned variant is one of the variants provided byNCContext.getVariants()
methods. Note that tokens returned by this method are a superset of the tokens returned bygetIntentTokens()
method, i.e. not all tokens from this variant may have been used in matching of the winning intent.- Returns:
- Sentence parsing variant that produced the matching for the winning intent.
- See Also:
getIntentTokens()
-
getUser
NCUser getUser()
Gets descriptor of the user on behalf of which the input request was submitted.- Returns:
- User descriptor.
-
getCompany
NCCompany getCompany()
Gets descriptor of the user's company on behalf of which the input request was submitted.- Returns:
- User company descriptor.
-
getServerRequestId
String getServerRequestId()
Gets globally unique server ID of the input request.Server request is defined as a processing of a one user input request. 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.
- Returns:
- Server request ID.
-
getNormalizedText
String getNormalizedText()
Gets normalized text of the user input.- Returns:
- Normalized text of the user input.
-
getReceiveTimestamp
long getReceiveTimestamp()
Gets UTC/GMT timestamp in milliseconds when user input was received.- Returns:
- UTC/GMT timestamp in milliseconds when user input was received.
-
getRemoteAddress
Optional<String> getRemoteAddress()
Gets optional address of the remote client that made the initial REST request.- Returns:
- Optional address of the remote client.
-
getClientAgent
Optional<String> getClientAgent()
Gets string representation of the user client agent that made the initial REST request .- Returns:
- User agent string from user client (web browser, REST client, etc.).
-
-