public interface NCConversation
Conversation management is based on idea of a short-term-memory (STM). STM can be viewed as a condensed
short-term history of the user input for a given user and data model. Every submitted user request that wasn't
rejected is added to the conversation STM as a list of tokens
. Existing STM tokens belonging to
the same group
will be overridden by the more recent tokens from the same group.
Note also that tokens in STM automatically expire (i.e. context is "forgotten") after a certain period of time
or based on other internal logic. Note that you should not rely on a specific expiration behavior as its logic
may be changed in the future.
NCQueryContext.getConversation()
Modifier and Type | Method and Description |
---|---|
void |
clearDialog(Predicate<String> filter)
Clears history of matched intents using given intent predicate.
|
void |
clearStm(Predicate<NCToken> filter)
Removes all tokens satisfying given predicate from the conversation STM.
|
List<NCToken> |
getTokens()
Gets an ordered list of tokens stored in the conversation STM for the current
user and data model.
|
List<NCToken> getTokens()
Note that this list excludes free words and stopwords. Note also that specific rules by which STM operates are undefined for the purpose of this function (i.e. callers should not rely on any observed behavior of how STM stores and evicts its content).
void clearStm(Predicate<NCToken> filter)
For example, in some cases the intent logic can assume the user current location as an implicit geo location and therefore all existing geo tokens should be removed from the conversation STM to maintain correct context.
filter
- Token remove filter.void clearDialog(Predicate<String> filter)
History of matched intents (i.e. the dialog flow) can be used in intent definition as part of its matching template. NLPCraft maintains the window of previously matched intents based on time, i.e. after certain period of time the oldest previously matched intents are forgotten and removed from dialog flow. This method allows explicitly clear previously matched intents from the dialog flow based on user logic other than time window.
filter
- Dialog flow filter based on IDs of previously matched intents.Copyright © 2020 NLPCraft. All rights reserved.