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
{{ message }}
This repository was archived by the owner on Apr 24, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: packages/jovo-model-snips/README.md
+220-1Lines changed: 220 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,7 @@ Learn how to turn the Jovo Model into a Snips NLU model.
4
4
5
5
-[Introduction](#introduction)
6
6
-[Using the Snips Jovo Model npm Package](#using-the-snips-jovo-model-npm-package)
7
+
-[Customizing the Jovo Model](#customizing-the-jovo-model)
7
8
8
9
## Introduction
9
10
@@ -20,4 +21,222 @@ Install the package like this:
20
21
$ npm install @jovotech/model-snips
21
22
```
22
23
23
-
You can learn more about all the Jovo Model features here: [Using the Jovo Model npm Packages](http://jovo.tech/marketplace/jovo-model#using-the-jovo-model-npm-packages).
24
+
You can learn more about all the Jovo Model features here: [Using the Jovo Model npm Packages](http://jovo.tech/marketplace/jovo-model#using-the-jovo-model-npm-packages).
25
+
26
+
Here is a code sample of how to convert from a Jovo model to a Snips dataset:
For Snips, the Jovo Model supports the following Intent entries:
40
+
-[Intent only](#intent-only)
41
+
-[Builtin entities](#builtin-entities)
42
+
-[Custom entities](#custom-entities)
43
+
-[Combined builtin and custom entities](#combined-builtin-and-custom-entities)
44
+
45
+
Look in the [examples](./examples/) folder to see how to structure a [Jovo model](./examples/basic/jovo4-model-en.json) and the corresponding [Snips dataset](./examples/basic/snips-dataset-en.json) that will be generated.
46
+
47
+
### Intent only
48
+
49
+
An intent-only entry includes an array of `phrases`:
50
+
51
+
```json
52
+
// Jovo model
53
+
{
54
+
"invocation": "my test app",
55
+
"version": "4.0",
56
+
"intents": {
57
+
"YesIntent": {
58
+
"phrases": [
59
+
"yes",
60
+
"yes please",
61
+
"sure"
62
+
]
63
+
}
64
+
}
65
+
}
66
+
```
67
+
68
+
69
+
### Builtin entities
70
+
71
+
An intent can include an array of `phrases` with `{variables}` that map to a key in the `entities` object.
72
+
73
+
For a builtin entity, the `type` starts with `"snips/"` followed by the entity type:
74
+
75
+
```json
76
+
// Jovo model
77
+
{
78
+
"invocation": "my test app",
79
+
"version": "4.0",
80
+
"intents": {
81
+
"NumberIntent": {
82
+
"phrases": [
83
+
"my number is {myNumber}"
84
+
],
85
+
"entities": {
86
+
"myNumber": {
87
+
"type": "snips/number"
88
+
}
89
+
}
90
+
}
91
+
}
92
+
}
93
+
```
94
+
95
+
For a list of builtin Snips types, see [Supported builtin entities](https://snips-nlu.readthedocs.io/en/latest/builtin_entities.html) and refer to the `Identifier` column.
96
+
97
+
### Custom entities
98
+
99
+
An intent can include an array of `phrases` with `{variables}` that map to a key in the `entities` object.
100
+
101
+
For a custom entity, the `type` will be a custom name that you define and a corresponding entry must be added to the `entityTypes` section. Custom entity types can include synonyms:
102
+
103
+
```json
104
+
// Jovo model
105
+
{
106
+
"invocation": "my test app",
107
+
"version": "4.0",
108
+
"intents": {
109
+
"ColorIntent": {
110
+
"phrases": [
111
+
"i pick {color}",
112
+
"my favorite color is {color}"
113
+
],
114
+
"entities": {
115
+
"color": {
116
+
"type": "CUSTOM_COLORS"
117
+
}
118
+
}
119
+
}
120
+
},
121
+
"entityTypes": {
122
+
"CUSTOM_COLORS": {
123
+
"name": "CUSTOM_COLORS",
124
+
"values": [
125
+
{
126
+
"value": "red",
127
+
"synonyms": [
128
+
"crimson"
129
+
]
130
+
},
131
+
{
132
+
"value": "yellow",
133
+
"synonyms": []
134
+
},
135
+
{
136
+
"value": "blue",
137
+
"synonyms": []
138
+
},
139
+
{
140
+
"value": "green",
141
+
"synonyms": []
142
+
},
143
+
{
144
+
"value": "orange",
145
+
"synonyms": []
146
+
},
147
+
{
148
+
"value": "purple",
149
+
"synonyms": []
150
+
}
151
+
]
152
+
}
153
+
}
154
+
}
155
+
```
156
+
157
+
**NOTICE**: There is a current limitation with the mapping of a Jovo model to a Snips dataset such that the values for `use_synonyms` and `automatically_extensible` are always `true` and `matching_strictness` is always `1`. With `automatically_extensible` set to `true` it means that the data list values provided are not all the values that will be recognized for the entity type.
158
+
159
+
```json
160
+
// Snips dataset (partial)
161
+
{
162
+
"CUSTOM_COLORS": {
163
+
"data": [
164
+
{
165
+
"value": "red",
166
+
"synonyms": [
167
+
"crimson"
168
+
]
169
+
},
170
+
{
171
+
"value": "yellow",
172
+
"synonyms": []
173
+
},
174
+
{
175
+
"value": "blue",
176
+
"synonyms": []
177
+
},
178
+
{
179
+
"value": "green",
180
+
"synonyms": []
181
+
},
182
+
{
183
+
"value": "orange",
184
+
"synonyms": []
185
+
},
186
+
{
187
+
"value": "purple",
188
+
"synonyms": []
189
+
}
190
+
],
191
+
"matching_strictness": 1,
192
+
"use_synonyms": true,
193
+
"automatically_extensible": true
194
+
},
195
+
}
196
+
```
197
+
198
+
### Combined builtin and custom entities
199
+
200
+
You can also combine builtin and custom entities for the same intent:
201
+
202
+
```json
203
+
// Jovo model
204
+
{
205
+
"invocation": "my test app",
206
+
"version": "4.0",
207
+
"intents": {
208
+
"WeatherIntent": {
209
+
"phrases": [
210
+
"give me the weather forecast for {weatherLocation} {weatherDate}"
0 commit comments