Recognizer Class
- java.
lang. Object - com.
microsoft. bot. dialogs. Recognizer
- com.
public class Recognizer
Recognizer base class.
Recognizers operate in a DialogContext environment to recognize user input into Intents and Entities.
This class models 3 virtual methods around * Pure DialogContext (where the recognition happens against current state dialogcontext * Activity (where the recognition is from an Activity) * Text/Locale (where the recognition is from text/locale)
The default implementation of DialogContext method is to use Context.Activity and call the activity method. The default implementation of Activity method is to filter to Message activities and pull out text/locale and call the text/locale method.
Field Summary
| Modifier and Type | Field and Description |
|---|---|
| static final java.lang.String |
CHOOSE_INTENT
Intent name that will be produced by this recognizer if the child recognizers do not have consensus for intents. |
| static final java.lang.String |
NONE_INTENT
Standard none intent that means none of the recognizers recognize the intent. |
Constructor Summary
| Constructor | Description |
|---|---|
| Recognizer() |
Initializes a new Recognizer. |
Method Summary
| Modifier and Type | Method and Description |
|---|---|
| java.util.concurrent.CompletableFuture<T> |
<T>recognize(DialogContext dialogContext, Activity activity, Map<String,String> telemetryProperties, Map<String,Double> telemetryMetrics, Class<T> c)
Runs current Dialog |
|
protected static
Recognizer |
createChooseIntentResult(Map<String,RecognizerResult> recognizerResults)
Returns Choose |
| protected java.util.Map<java.lang.String,java.lang.String> |
fillRecognizerResultTelemetryProperties(RecognizerResult recognizerResult, Map<String,String> telemetryProperties, DialogContext dialogContext)
Uses the Recognizer |
| java.lang.String |
getId()
Gets id of the recognizer. |
|
Bot |
getTelemetryClient()
Gets the currently configured Bot |
|
java.util.concurrent.CompletableFuture<Recognizer |
recognize(DialogContext dialogContext, Activity activity)
Runs current Dialog |
|
java.util.concurrent.CompletableFuture<Recognizer |
recognize(DialogContext dialogContext, Activity activity, Map<String,String> telemetryProperties, Map<String,Double> telemetryMetrics)
Runs current Dialog |
| void |
setId(String withId)
Sets id of the recognizer. |
| void |
setTelemetryClient(BotTelemetryClient withTelemetryClient)
Sets the currently configured Bot |
| protected void |
trackRecognizerResult(DialogContext dialogContext, String eventName, Map<String,String> telemetryProperties, Map<String,Double> telemetryMetrics)
Tracks an event with the event name provided using the Telemetry |
Methods inherited from java.lang.Object
Field Details
CHOOSE_INTENT
public static final String CHOOSE_INTENT
Intent name that will be produced by this recognizer if the child recognizers do not have consensus for intents.
NONE_INTENT
public static final String NONE_INTENT
Standard none intent that means none of the recognizers recognize the intent. If each recognizer returns no intents or None intents, then this recognizer will return None intent.
Constructor Details
Recognizer
public Recognizer()
Initializes a new Recognizer.
Method Details
<T>recognize
public CompletableFuture
Runs current DialogContext.TurnContext.Activity through a recognizer and returns a strongly-typed recognizer result using RecognizerConvert.
Parameters:
Returns:
createChooseIntentResult
protected static RecognizerResult createChooseIntentResult(Map
Returns ChooseIntent between multiple recognizer results.
Parameters:
Returns:
fillRecognizerResultTelemetryProperties
protected Map
Uses the RecognizerResult to create a list of propeties to be included when tracking the result in telemetry.
Parameters:
Returns:
getId
public String getId()
Gets id of the recognizer.
Returns:
getTelemetryClient
public BotTelemetryClient getTelemetryClient()
Gets the currently configured BotTelemetryClient that logs the RecognizerResult event.
Returns:
recognize
public CompletableFuture
Runs current DialogContext.TurnContext.Activity through a recognizer and returns a generic recognizer result.
Parameters:
Returns:
recognize
public CompletableFuture
Runs current DialogContext.TurnContext.Activity through a recognizer and returns a generic recognizer result.
Parameters:
Returns:
setId
public void setId(String withId)
Sets id of the recognizer.
Parameters:
setTelemetryClient
public void setTelemetryClient(BotTelemetryClient withTelemetryClient)
Sets the currently configured BotTelemetryClient that logs the RecognizerResult event.
Parameters:
trackRecognizerResult
protected void trackRecognizerResult(DialogContext dialogContext, String eventName, Map
Tracks an event with the event name provided using the TelemetryClient attaching the properties / metrics.
Parameters: