You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/cognitive-services/Speech-Service/how-to-use-custom-entity-pattern-matching.md
+6-13Lines changed: 6 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,17 +29,14 @@ In this guide, you use the Speech SDK to develop a console application that deri
29
29
> - Add custom entities via the Speech SDK API
30
30
> - Use asynchronous, event-driven continuous recognition
31
31
32
-
## When should you use this?
32
+
## When to use pattern matching
33
33
34
-
Use this sample code if:
34
+
Use this sample code if:
35
+
* You're only interested in matching strictly what the user said. These patterns match more aggressively than LUIS.
36
+
* You don't have access to a [LUIS](../LUIS/index.yml) app, but still want intents.
37
+
* You can't or don't want to create a [LUIS](../LUIS/index.yml) app but you still want some voice-commanding capability.
35
38
36
-
- You are only interested in matching very strictly what the user said. These patterns match more aggressively than LUIS.
37
-
- You do not have access to a [LUIS](../LUIS/index.yml) app, but still want intents. This can be helpful since it is embedded within the SDK.
38
-
- You cannot or do not want to create a LUIS app but you still want some voice-commanding capability.
39
-
40
-
If you do not have access to a [LUIS](../LUIS/index.yml) app, but still want intents, this can be helpful since it is embedded within the SDK.
41
-
42
-
For supported locales see [here](./language-support.md?tabs=IntentRecognitionPatternMatcher).
39
+
For more information, see the [pattern matching overview](./pattern-matching-overview.md).
43
40
44
41
## Prerequisites
45
42
@@ -48,10 +45,6 @@ Be sure you have the following items before you begin this guide:
48
45
- A [Cognitive Services Azure resource](https://portal.azure.com/#create/Microsoft.CognitiveServicesSpeechServices) or a [Unified Speech resource](https://portal.azure.com/#create/Microsoft.CognitiveServicesSpeechServices)
49
46
-[Visual Studio 2019](https://visualstudio.microsoft.com/downloads/) (any edition).
@@ -28,16 +28,14 @@ In this guide, you use the Speech SDK to develop a C++ console application that
28
28
> - Recognize speech from a microphone
29
29
> - Use asynchronous, event-driven continuous recognition
30
30
31
-
## When should you use this?
31
+
## When to use pattern matching
32
32
33
33
Use this sample code if:
34
-
* You are only interested in matching very strictly what the user said. These patterns match more aggressively than LUIS.
35
-
* You do not have access to a [LUIS](../LUIS/index.yml) app, but still want intents. This can be helpful since it is embedded within the SDK.
36
-
* You cannot or do not want to create a [LUIS](../LUIS/index.yml) app but you still want some voice-commanding capability.
34
+
* You're only interested in matching strictly what the user said. These patterns match more aggressively than LUIS.
35
+
* You don't have access to a [LUIS](../LUIS/index.yml) app, but still want intents.
36
+
* You can't or don't want to create a [LUIS](../LUIS/index.yml) app but you still want some voice-commanding capability.
37
37
38
-
If you do not have access to a [LUIS](../LUIS/index.yml) app, but still want intents, this can be helpful since it is embedded within the SDK.
39
-
40
-
For supported locales see [here](./language-support.md?tabs=IntentRecognitionPatternMatcher).
38
+
For more information, see the [pattern matching overview](./pattern-matching-overview.md).
41
39
42
40
## Prerequisites
43
41
@@ -50,14 +48,12 @@ Be sure you have the following items before you begin this guide:
50
48
51
49
The simple patterns are a feature of the Speech SDK and need a Cognitive Services resource or a Unified Speech resource.
52
50
53
-
A pattern is a phrase that includes an Entity somewhere within it. An Entity is defined by wrapping a word in curly brackets. For example:
51
+
A pattern is a phrase that includes an Entity somewhere within it. An Entity is defined by wrapping a word in curly brackets. This example defines an Entity with the ID "floorName", which is case-sensitive:
54
52
55
53
```
56
54
Take me to the {floorName}
57
55
```
58
56
59
-
This defines an Entity with the ID "floorName" which is case-sensitive.
60
-
61
57
All other special characters and punctuation will be ignored.
62
58
63
59
Intents will be added using calls to the IntentRecognizer->AddIntent() API.
@@ -68,4 +64,9 @@ Intents will be added using calls to the IntentRecognizer->AddIntent() API.
Copy file name to clipboardExpand all lines: articles/cognitive-services/Speech-Service/includes/get-speech-sdk-java.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ ms.author: eur
8
8
9
9
:::row:::
10
10
:::column span="3":::
11
-
The Java SDK for Android is packaged as an <ahref="https://developer.android.com/studio/projects/android-library"target="_blank">AAR (Android Library)</a>, which includes the necessary libraries and required Android permissions. It's hosted in a Maven repository at `https://csspeechstorage.blob.core.windows.net/maven/` as package `com.microsoft.cognitiveservices.speech:client-sdk:1.19.0`. Make sure 1.19.0 is the latest version by [searching our GitHub repo](https://github.com/Azure-Samples/cognitive-services-speech-sdk/search?q=com.microsoft.cognitiveservices.speech%3Aclient-sdk).
11
+
The Java SDK for Android is packaged as an <ahref="https://developer.android.com/studio/projects/android-library"target="_blank">AAR (Android Library)</a>, which includes the necessary libraries and required Android permissions. It's hosted in a Maven repository at `https://azureai.azureedge.net/maven/` as package `com.microsoft.cognitiveservices.speech:client-sdk:1.19.0`. Make sure 1.19.0 is the latest version by [searching our GitHub repo](https://github.com/Azure-Samples/cognitive-services-speech-sdk/search?q=com.microsoft.cognitiveservices.speech%3Aclient-sdk).
12
12
:::column-end:::
13
13
:::column:::
14
14
<br>
@@ -22,12 +22,12 @@ To consume the package from your Android Studio project, make the following chan
22
22
23
23
1. In the project-level *build.gradle* file, add the following to the `repositories` section:
Copy file name to clipboardExpand all lines: articles/cognitive-services/Speech-Service/includes/how-to/intent-recognition/cpp/simple-pattern-matching.md
+1-6Lines changed: 1 addition & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -239,9 +239,4 @@ Say something ...
239
239
RECOGNIZED: Text = Take me to floor 7.
240
240
Intent Id = ChangeFloors
241
241
Floor name: = 7
242
-
```
243
-
244
-
## Next steps
245
-
246
-
> Improve your pattern matching by using [custom entities](../../../../how-to-use-custom-entity-pattern-matching.md).
Copy file name to clipboardExpand all lines: articles/cognitive-services/Speech-Service/includes/how-to/intent-recognition/csharp/simple-pattern-matching.md
+1-6Lines changed: 1 addition & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -269,9 +269,4 @@ Say something ...
269
269
RECOGNIZED: Text= Take me to floor 7.
270
270
Intent Id= ChangeFloors
271
271
FloorName= 7
272
-
```
273
-
274
-
## Next steps
275
-
276
-
> Improve your pattern matching by using [custom entities](../../../../how-to-use-custom-entity-pattern-matching.md).
Copy file name to clipboardExpand all lines: articles/cognitive-services/Speech-Service/includes/pattern-matching-overview.md
+35-25Lines changed: 35 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ Pattern matching can be customized to group together pattern intents and entitie
14
14
15
15
For supported locales see [here](../language-support.md?tabs=IntentRecognitionPatternMatcher).
16
16
17
-
###Patterns vs. Exact Phrases
17
+
## Patterns vs. Exact Phrases
18
18
19
19
There are two types of strings used in the pattern matcher: "exact phrases" and "patterns". It's important to understand the differences.
20
20
@@ -26,25 +26,25 @@ A pattern is a phrase that contains a marked entity. Entities are marked with "{
26
26
27
27
> "Take me to floor {floorName}"
28
28
29
-
###Outline of a PatternMatchingModel
29
+
## Outline of a PatternMatchingModel
30
30
31
31
The ``PatternMatchingModel`` contains an ID to reference that model by, a list of ``PatternMatchingIntent`` objects, and a list of ``PatternMatchingEntity`` objects.
32
32
33
-
####Pattern Matching Intents
33
+
### Pattern Matching Intents
34
34
35
35
``PatternMatchingIntent`` objects represent a collection of phrases that will be used to evaluate speech or text in the ``IntentRecognizer``. If the phrases are matched, the ``IntentRecognitionResult`` returned will have the ID of the ``PatternMatchingIntent`` that was matched.
36
36
37
-
####Pattern Matching Entities
37
+
### Pattern Matching Entities
38
38
39
39
``PatternMatchingEntity`` objects represent an individual entity reference and its corresponding properties that tell the ``IntentRecognizer`` how to treat it. All ``PatternMatchingEntity`` objects must have an ID that is present in a phrase or else it will never be matched.
40
40
41
-
#####Entity Naming restrictions
41
+
#### Entity Naming restrictions
42
42
43
43
Entity names containing ':' characters will assign a role to an entity. (See below)
44
44
45
-
###Types of Entities
45
+
## Types of Entities
46
46
47
-
####Any Entity
47
+
### Any Entity
48
48
49
49
The "Any" entity will match any text that appears in that slot regardless of the text it contains. If we consider our previous example using the pattern "Take me to floor {floorName}", the user might say something like:
50
50
@@ -60,7 +60,7 @@ In this case, the utterance "Take me to the floor parking 2" would match and ret
60
60
61
61
It may be tricky to handle extra text if it's captured. Perhaps the user kept talking and the utterance captured more than their command. "Take me to floor parking 2 yes Janice I heard about that let's". In this case the floorName1 would be correct, but floorName2 would = "2 yes Janice I heard about that let's". It's important to be aware of the way the Entities will match and adjust to your scenario appropriately. The Any entity type is the most basic and least precise.
62
62
63
-
####List Entity
63
+
### List Entity
64
64
65
65
The "List" entity is made up of a list of phrases that will guide the engine on how to match it. The "List" entity has two modes. "Strict" and "Fuzzy".
66
66
@@ -79,13 +79,13 @@ It's important to note that the Intent will not match, not just the entity.
79
79
When an entity is of type "List" and is in "Fuzzy" mode, the engine will still match the Intent, and will return the text that appeared in the slot in the utterance even if it's not in the list. This is useful behind the scenes to help make the speech recognition better.
80
80
81
81
> [!WARNING]
82
-
> Fuzzy list entities are not currently implemented.
82
+
> Fuzzy list entities are implemented, but not integrated into the speech recognition part. Therefore, they will match entities, but not improve speech recognition.
83
83
84
-
####Prebuilt Integer Entity
84
+
### Prebuilt Integer Entity
85
85
86
86
The "PrebuiltInteger" entity is used when you expect to get an integer in that slot. It won't match the intent if an integer cannot be found. The return value is a string representation of the number.
87
87
88
-
####Examples of a valid match and return values
88
+
### Examples of a valid match and return values
89
89
90
90
> "Two thousand one hundred and fifty-five" -> "2155"
91
91
@@ -97,7 +97,7 @@ The "PrebuiltInteger" entity is used when you expect to get an integer in that s
97
97
98
98
If there's text that is not recognizable as a number, the entity and intent will not match.
99
99
100
-
####Examples of an invalid match
100
+
### Examples of an invalid match
101
101
102
102
> "the third"
103
103
@@ -113,48 +113,52 @@ Consider our elevator example.
113
113
114
114
If "floorName" is a prebuilt integer entity, the expectation is that whatever text is inside the slot will represent an integer. Here a floor number would match well, but a floor with a name such as "lobby" would not.
115
115
116
-
### Optional items and grouping
116
+
##Grouping required and optional items
117
117
118
-
In the pattern it's allowed to include words or entities that may be present in the utterance or not. This is especially useful for determiners like "the", "a", or "an". This doesn't have any functional difference from hard coding out the many combinations, but can help reduce the number of patterns needed. Indicate optional items with "[" and "]". You may include multiple items in the same group by separating them with a '|' character.
118
+
In the pattern it's allowed to include words or entities that may be present in the utterance or not. This is especially useful for determiners like "the", "a", or "an". This doesn't have any functional difference from hard coding out the many combinations, but can help reduce the number of patterns needed. Indicate optional items with "[" and "]". Indicate required items with "(" and ")". You may include multiple items in the same group by separating them with a '|' character.
119
119
120
120
To see how this would reduce the number of patterns needed consider the following set.
121
121
122
-
> "Take me to the {floorName}"
122
+
> "Take me to {floorName}"
123
123
124
124
> "Take me the {floorName}"
125
125
126
-
> "Take me to {floorName}"
126
+
> "Take me {floorName}"
127
127
128
-
> "take me {floorName}"
128
+
> "Take me to {floorName} please"
129
129
130
-
> "Take me to the {floorName}" please
130
+
> "Take me the {floorName} please"
131
131
132
-
> "Take me the {floorName}" please
132
+
> "Take me {floorName} please"
133
133
134
-
> "Take me to {floorName}" please
134
+
> "Bring me {floorName} please"
135
135
136
-
> "take me {floorName}" please
136
+
> "Bring me to {floorName} please"
137
137
138
-
These can all be reduced to a single pattern with optional items.
138
+
These can all be reduced to a single pattern with grouping and optional items. First, it is possible to group "to" and "the" together as optional words like so: "[to | the]", and second we can make the "please" optional as well. Last, we can group the "bring" and "take" as required.
139
139
140
-
>"Take me [to | the] {floorName} [please]"
140
+
>"(Bring | Take) me [to | the] {floorName} [please]"
141
141
142
142
It's also possible to include optional entities. Imagine there are multiple parking levels and you want to match the word before the {floorName}. You could do so with a pattern like this:
143
143
144
144
>"Take me to [{floorType}] {floorName}"
145
145
146
+
Optionals are also very useful if you might be using keyword recognition and a push-to-talk function. This means sometimes the keyword will be present, and sometimes it won't. Assuming your keyword was "computer" your pattern would look something like this.
147
+
148
+
>"[Computer] Take me to {floorName}"
149
+
146
150
> [!NOTE]
147
151
> While it's helpful to use optional items, it increases the chances of pattern collisions. This is where two patterns can match the same-spoken phrase. If this occurs, it can sometimes be solved by separating out the optional items into separate patterns.
148
152
149
-
###Entity roles
153
+
## Entity roles
150
154
151
155
Inside the pattern, there may be a scenario where you want to use the same entity multiple times. Consider the scenario of booking a flight from one city to another. In this case the list of cities is the same, but it's necessary to know which city is the user coming from and which city is the destination. To accomplish this, you can use a role assigned to an entity using a ':'.
152
156
153
157
> "Book a flight from {city:from} to {city:destination}"
154
158
155
159
Given a pattern like this, there will be two entities in the result labeled "city:from" and "city:destination" but they'll both be referencing the "city" entity for matching purposes.
156
160
157
-
###Intent Matching Priority
161
+
## Intent Matching Priority
158
162
159
163
Sometimes multiple patterns may match the same utterance. In this case, the engine will give priority to patterns as follows.
160
164
@@ -163,3 +167,9 @@ Sometimes multiple patterns may match the same utterance. In this case, the engi
163
167
3. Patterns with Integer Entities.
164
168
4. Patterns with List Entities.
165
169
5. Patterns with Any Entities.
170
+
171
+
## Next steps
172
+
173
+
* Start with [simple pattern matching](../how-to-use-simple-language-pattern-matching.md).
174
+
* Improve your pattern matching by using [custom entities](../how-to-use-custom-entity-pattern-matching.md).
175
+
* Look through our [GitHub samples](https://github.com/Azure-Samples/cognitive-services-speech-sdk).
Copy file name to clipboardExpand all lines: articles/cognitive-services/Speech-Service/includes/quickstarts/platform/java-jre.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ ms.custom: devx-track-java
13
13
ms.author: eur
14
14
---
15
15
16
-
This guide shows how to install the [Speech SDK](~/articles/cognitive-services/speech-service/speech-sdk.md) for Java. If you just want the package name to get started on your own, the Java SDK is not available in the Maven central repository. Whether you're using Gradle or a *pom.xml* dependency file, you need to add a custom repository that points to `https://csspeechstorage.blob.core.windows.net/maven/`. (See below for the package name.)
16
+
This guide shows how to install the [Speech SDK](~/articles/cognitive-services/speech-service/speech-sdk.md) for Java. If you just want the package name to get started on your own, the Java SDK is not available in the Maven central repository. Whether you're using Gradle or a *pom.xml* dependency file, you need to add a custom repository that points to `https://azureai.azureedge.net/maven/`. (See below for the package name.)
0 commit comments