public class IntentRecognitionHelper extends Object
This class can be used by RuntimeEventProvider
s that receive user messages and translate them to
intents. It automatically manages the recognition as well as the session attributes that need to be updated
once an intent has been recognized.
Constructor and Description |
---|
IntentRecognitionHelper() |
Modifier and Type | Method and Description |
---|---|
static com.xatkit.intent.RecognizedIntent |
getRecognizedIntent(String input,
XatkitSession session,
XatkitCore xatkitCore)
Returns the
RecognizedIntent from the provided user input and session . |
public static com.xatkit.intent.RecognizedIntent getRecognizedIntent(String input, XatkitSession session, XatkitCore xatkitCore)
RecognizedIntent
from the provided user input
and session
.
This uses the provided xatkitCore
to wrap the access to the underlying
IntentRecognitionProvider
, and avoid uncontrolled accesses to the
IntentRecognitionProvider
from RuntimeEventProvider
s (such as intent creation,
removal, and context manipulation).
Note: this method decrements the lifespan counts of the variables in the current context (context
lifespan are used to represent the number of user interaction to handled before deleting the variable).
Client classes must call this method before setting any context variable otherwise there lifespan
counts may be inconsistent from their expected values (e.g. context variables with a lifespan count of 1
will be immediately removed by the RuntimeContexts.decrementLifespanCounts()
call).
input
- the textual user input to extract the RecognizedIntent
fromsession
- the XatkitSession
wrapping the underlying IntentRecognitionProvider
's sessionRecognizedIntent
computed by the IntentRecognitionProvider
NullPointerException
- if the provided text
or session
is null
IllegalArgumentException
- if the provided text
is emptyIntentRecognitionProviderException
- if the IntentRecognitionProvider
is shutdown or if an
exception is thrown by the underlying intent recognition engineCopyright © 2020 SOM Research Lab. All rights reserved.