public abstract class IntentRecognitionProvider extends Object
This interface provides utility methods to connect to a given intent recognition provider, register and delete
IntentDefinition
s, create XatkitSession
s, and compute the RecognizedIntent
from a given
input text.
Constructor and Description |
---|
IntentRecognitionProvider() |
Modifier and Type | Method and Description |
---|---|
abstract XatkitSession |
createSession(String sessionId)
Creates a new
XatkitSession from the provided sessionId . |
abstract void |
deleteEntityDefinition(com.xatkit.intent.EntityDefinition entityDefinition)
Deletes the provided
entityDefinition from the underlying intent recognition provider. |
abstract void |
deleteIntentDefinition(com.xatkit.intent.IntentDefinition intentDefinition)
Deletes the provided
intentDefinition from the underlying intent recognition provider. |
com.xatkit.intent.RecognizedIntent |
getIntent(String input,
XatkitSession session)
Returns the
RecognizedIntent extracted from te provided input . |
protected abstract com.xatkit.intent.RecognizedIntent |
getIntentInternal(String input,
XatkitSession session)
Returns the raw
RecognizedIntent extracted from the provided input . |
abstract RecognitionMonitor |
getRecognitionMonitor()
Returns the
RecognitionMonitor associated to this intent recognition provider. |
abstract boolean |
isShutdown()
Returns whether the intent recognition provider client is shutdown.
|
abstract void |
registerEntityDefinition(com.xatkit.intent.EntityDefinition entityDefinition)
Registers the provided
entityDefinition in the underlying intent recognition provider. |
abstract void |
registerIntentDefinition(com.xatkit.intent.IntentDefinition intentDefinition)
Registers the provided
intentDefinition in the underlying intent recognition provider. |
void |
setPostProcessors(List<? extends IntentPostProcessor> postProcessors)
Set the
IntentPostProcessor s. |
void |
setPreProcessors(List<? extends InputPreProcessor> preProcessors)
Sets the
InputPreProcessor s. |
abstract void |
shutdown()
Shuts down the intent recognition provider client and invalidates the remaining sessions.
|
abstract void |
trainMLEngine()
Trains the underlying intent recognition provider.
|
public final void setPreProcessors(List<? extends InputPreProcessor> preProcessors)
InputPreProcessor
s.preProcessors
- the InputPreProcessor
to setpublic final void setPostProcessors(List<? extends IntentPostProcessor> postProcessors)
IntentPostProcessor
s.postProcessors
- the IntentPostProcessor
to setpublic abstract void registerEntityDefinition(com.xatkit.intent.EntityDefinition entityDefinition)
entityDefinition
in the underlying intent recognition provider.
Note: unless explicitly stated in subclasses, this method does not train the underlying machine
learning engine, so multiple entity registrations does not generate multiple training calls. Once all the
EntityDefinition
s have been registered in the underlying intent recognition provider use
trainMLEngine()
to train the ML engine.
entityDefinition
- the EntityDefinition
to delete from the underlying intent recognition providertrainMLEngine()
public abstract void registerIntentDefinition(com.xatkit.intent.IntentDefinition intentDefinition)
intentDefinition
in the underlying intent recognition provider.
Note: unless explicitly stated in subclasses, this method does not train the underlying machine
learning engine, so multiple intent registrations does not generate multiple training calls. Once all the
IntentDefinition
s have been registered in the underlying intent recognition provider use
trainMLEngine()
to train the ML engine.
intentDefinition
- the IntentDefinition
to register to the underlying intent recognition providertrainMLEngine()
public abstract void deleteEntityDefinition(com.xatkit.intent.EntityDefinition entityDefinition)
entityDefinition
from the underlying intent recognition provider.
Note: unless explicitly stated in subclasses, this method does not train the underlying machine
learning engine, so multiple entity deletion does not generate multiple training calls. Once all the
EntityDefinition
s have been deleted from the underlying intent recognition provider use
trainMLEngine()
to train the ML engine.
entityDefinition
- the EntityDefinition
to delete from the underlying intent recognition providertrainMLEngine()
public abstract void deleteIntentDefinition(com.xatkit.intent.IntentDefinition intentDefinition)
intentDefinition
from the underlying intent recognition provider.
Note: unless explicitly stated in subclasses, this method does not train the underlying machine
learning engine, so multiple intent deletion does not generate multiple training calls. Once all the
IntentDefinition
s have been deleted from the underlying intent recognition provider use
trainMLEngine()
to train the ML engine.
intentDefinition
- the IntentDefinition
to delete from the underlying intent recognition providertrainMLEngine()
public abstract void trainMLEngine()
Note: this method returns once the intent recognition provider's training is complete. However, the propagation of the training information may not be complete when this method returns.
public abstract XatkitSession createSession(String sessionId)
XatkitSession
from the provided sessionId
.sessionId
- the identifier to create a session fromXatkitSession
for the provided sessionId
public abstract void shutdown()
Note: calling this method invalidates the intent recognition provider client connection, and thus this class cannot be used to access the intent recognition provider anymore.
public abstract boolean isShutdown()
true
if the intent recognition provider client is shutdown, false
otherwisepublic final com.xatkit.intent.RecognizedIntent getIntent(String input, XatkitSession session)
RecognizedIntent
extracted from te provided input
.
This method uses the provided session
to extract contextual intents, such as follow-up or
context-based intents.
This method applies the pre-processing functions associated to this IntentRecognitionProvider
on the
given input
, and the post-processing functions on the returned RecognizedIntent
.
input
- the String
representing the textual input to process and extract the intent fromsession
- the XatkitSession
used to access context informationRecognizedIntent
extracted from the provided input
and session
IntentRecognitionProviderFactory.getIntentRecognitionProvider(XatkitCore, Configuration)
protected abstract com.xatkit.intent.RecognizedIntent getIntentInternal(String input, XatkitSession session)
RecognizedIntent
extracted from the provided input
.
This method is called after pre-processing of the input
(i.e. the given input
is
already pre-processed), and does not apply any post-processing function (this is done by
getIntent(String, XatkitSession)
). Subclasses implementing this method should not take care of
pre/post processing.
input
- the textual input to process and extract the intent fromsession
- the XatkitSession
used to access context informationRecognizedIntent
extracted from the provided input
and session
@Nullable public abstract RecognitionMonitor getRecognitionMonitor()
RecognitionMonitor
associated to this intent recognition provider.RecognitionMonitor
, or null
if analytics monitoring is disabled.Copyright © 2020 SOM Research Lab. All rights reserved.