Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.

Commit 2058206

Browse files
authored
Updating tests. (#200)
1 parent 2c5897e commit 2058206

File tree

11 files changed

+96
-30
lines changed

11 files changed

+96
-30
lines changed

packages/luis/src/parser/converters/luistoluconverter.js

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ module.exports = {
3333
updateUtterancesList(LUISJSON.patterns, luisObj.intents, 'pattern');
3434
if(luisObj.intents.length >= 0) {
3535
fileContent += NEWLINE;
36+
fileContent += addAppMetaData(LUISJSON);
3637
fileContent += '> # Intent definitions' + NEWLINE + NEWLINE;
3738
// write out intents and utterances..
3839
luisObj.intents.forEach(function(intent) {
@@ -187,6 +188,19 @@ module.exports = {
187188
return fileContent;
188189
}
189190
}
191+
/**
192+
* Helper to add application inforamtion metadata
193+
* @param {Object} LUISJSON
194+
*/
195+
const addAppMetaData = function(LUISJSON) {
196+
let fileContent = '';
197+
if (LUISJSON.name) fileContent += `> !# @app.name = ${LUISJSON.name}` + NEWLINE;
198+
if (LUISJSON.desc) fileContent += `> !# @app.desc = ${LUISJSON.desc}` + NEWLINE;
199+
if (LUISJSON.versionId) fileContent += `> !# @app.versionId = ${LUISJSON.versionId}` + NEWLINE;
200+
if (LUISJSON.culture) fileContent += `> !# @app.culture = ${LUISJSON.culture}` + NEWLINE;
201+
if (LUISJSON.luis_schema_version) fileContent += `> !# @app.luis_schema_version = ${LUISJSON.luis_schema_version}` + NEWLINE;
202+
return fileContent === '' ? fileContent : `> LUIS application information` + NEWLINE + fileContent + NEWLINE + NEWLINE;
203+
}
190204
/**
191205
* Helper function to handle nDepth entity definition
192206
* @param {Object} entity
@@ -324,17 +338,6 @@ const objectSortByStartPos = function (objectArray) {
324338
return ObjectByStartPos;
325339
}
326340

327-
constructModelDescFromLUISJSON = async function(LUISJSON) {
328-
let modelDesc = NEWLINE;
329-
modelDesc += '> LUIS application information' + NEWLINE;
330-
modelDesc += '> !# @app.name = ' + LUISJSON.name + NEWLINE;
331-
modelDesc += '> !# @app.desc = ' + LUISJSON.desc + NEWLINE;
332-
modelDesc += '> !# @app.culture = ' + LUISJSON.culture + NEWLINE;
333-
modelDesc += '> !# @app.versionId = ' + LUISJSON.versionId + NEWLINE;
334-
modelDesc += '> !# @app.luis_schema_version = ' + LUISJSON.luis_schema_version + NEWLINE;
335-
return modelDesc;
336-
}
337-
338341
/**
339342
* Helper function to return sorted LUIS JSON model
340343
* @param {Object} LUISJSON

packages/luis/test/fixtures/translation/fr/root.luis.json

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -73,67 +73,67 @@
7373
"entities": []
7474
},
7575
{
76-
"text": "calendrier pour novembre 1948",
76+
"text": "dites-moi les détails de l'événement",
7777
"intent": "Calendar.Find",
7878
"entities": []
7979
},
8080
{
81-
"text": "afficher les plans de week-end",
81+
"text": "voix activée lecture des rendez-vous cette semaine",
8282
"intent": "Calendar.Find",
8383
"entities": []
8484
},
8585
{
86-
"text": "ai-je quelque chose le mercredi?",
86+
"text": "suis-je libre d'être avec des amis samedi ?",
8787
"intent": "Calendar.Find",
8888
"entities": []
8989
},
9090
{
91-
"text": "Combien de jours y a-t-il entre le 13 mars 2015 et aujourd'hui ?",
91+
"text": "rendez-vous avec Johnson doit être la semaine prochaine",
9292
"intent": "Calendar.Find",
9393
"entities": []
9494
},
9595
{
96-
"text": "tirer vers le haut de mon rendez-vous savoir combien de temps j'ai avant mon prochain rendez-vous",
96+
"text": "appeler papa mike",
9797
"intent": "Calendar.Find",
9898
"entities": []
9999
},
100100
{
101-
"text": "recherche de rencontres avec Chris",
101+
"text": "changer la réunion avec Chris à 9: 00 h",
102102
"intent": "Calendar.Find",
103103
"entities": []
104104
},
105105
{
106-
"text": "montrez-moi l'heure de la fête de mariage de demain",
106+
"text": "email cloney john",
107107
"intent": "Calendar.Find",
108108
"entities": []
109109
},
110110
{
111-
"text": "dites-moi les détails de l'événement",
111+
"text": "prolonger la réunion du déjeuner 30 minutes de plus",
112112
"intent": "Calendar.Find",
113113
"entities": []
114114
},
115115
{
116-
"text": "voix activée lecture des rendez-vous cette semaine",
116+
"text": "Je veux reprogrammer la réuni on au club de l'armée de l'air",
117117
"intent": "Calendar.Find",
118118
"entities": []
119119
},
120120
{
121-
"text": "suis-je libre d'être avec des amis samedi ?",
121+
"text": "réunions de marketing le mardi sera maintenant tous les mercredis s'il vous plaît changer sur mon calendrier",
122122
"intent": "None",
123123
"entities": []
124124
},
125125
{
126-
"text": "rendez-vous avec Johnson doit être la semaine prochaine",
126+
"text": "déplacer la fête bbq à vendredi",
127127
"intent": "None",
128128
"entities": []
129129
},
130130
{
131-
"text": "appeler papa mike",
131+
"text": "l'atelier durera 10 heures",
132132
"intent": "None",
133133
"entities": []
134134
},
135135
{
136-
"text": "changer la réunion avec Chris à 9: 00 h",
136+
"text": "change the meeting with chris to 9 : 00 am",
137137
"intent": "None",
138138
"entities": []
139139
},
@@ -143,32 +143,36 @@
143143
"entities": []
144144
},
145145
{
146-
"text": "prolonger la réunion du déjeuner 30 minutes de plus",
146+
"text": "extend lunch meeting 30 minutes extra",
147147
"intent": "None",
148148
"entities": []
149149
},
150150
{
151-
"text": "Je veux reprogrammer la réuni on au club de l'armée de l'air",
151+
"text": "i want to reschedule the meeting at the air force club",
152152
"intent": "None",
153153
"entities": []
154154
},
155155
{
156-
"text": "réunions de marketing le mardi sera maintenant tous les mercredis s'il vous plaît changer sur mon calendrier",
156+
"text": "marketing meetings on tuesdays will now be every wednesday please change on my calendar",
157157
"intent": "None",
158158
"entities": []
159159
},
160160
{
161-
"text": "déplacer la fête bbq à vendredi",
161+
"text": "move the bbq party to friday",
162162
"intent": "None",
163163
"entities": []
164164
},
165165
{
166-
"text": "l'atelier durera 10 heures",
166+
"text": "the workshop will last for 10 hours",
167167
"intent": "None",
168168
"entities": []
169169
}
170170
],
171171
"patterns": [],
172172
"patternAnyEntities": [],
173-
"prebuiltEntities": []
173+
"prebuiltEntities": [],
174+
"name": "file",
175+
"versionId": "0.1",
176+
"culture": "en-us",
177+
"luis_schema_version": "3.2.0"
174178
}

packages/luis/test/fixtures/verified/allGen.lu

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11

2+
> LUIS application information
3+
> !# @app.name = all
4+
> !# @app.versionId = 0.1
5+
> !# @app.culture = en-us
6+
> !# @app.luis_schema_version = 3.2.0
7+
8+
29
> # Intent definitions
310

411
## Greeting

packages/luis/test/fixtures/verified/luis_sorted.lu

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11

2+
> LUIS application information
3+
> !# @app.name = all
4+
> !# @app.versionId = 0.1
5+
> !# @app.culture = en-us
6+
> !# @app.luis_schema_version = 3.2.0
7+
8+
29
> # Intent definitions
310

411
## AskForUserName

packages/luis/test/fixtures/verified/modelAsFeatureGen.lu

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11

2+
> LUIS application information
3+
> !# @app.versionId = 0.1
4+
> !# @app.culture = en-us
5+
> !# @app.luis_schema_version = 3.2.0
6+
7+
28
> # Intent definitions
39

410
## test1

packages/luis/test/fixtures/verified/nDepthEntityInUtterance.lu

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11

2+
> LUIS application information
3+
> !# @app.versionId = 0.1
4+
> !# @app.culture = en-us
5+
> !# @app.luis_schema_version = 3.2.0
6+
7+
28
> # Intent definitions
39

410
## None

packages/luis/test/fixtures/verified/newEntity1.lu

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11

2+
> LUIS application information
3+
> !# @app.versionId = 0.1
4+
> !# @app.culture = en-us
5+
> !# @app.luis_schema_version = 3.2.0
6+
7+
28
> # Intent definitions
39

410
> # Entity definitions

packages/luis/test/fixtures/verified/newEntity2.lu

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11

2+
> LUIS application information
3+
> !# @app.versionId = 0.1
4+
> !# @app.culture = en-us
5+
> !# @app.luis_schema_version = 3.2.0
6+
7+
28
> # Intent definitions
39

410
> # Entity definitions

packages/luis/test/fixtures/verified/plFeatures.lu

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11

2+
> LUIS application information
3+
> !# @app.name = AppName
4+
> !# @app.versionId = 0.1
5+
> !# @app.culture = en-us
6+
> !# @app.luis_schema_version = 5.0.0
7+
8+
29
> # Intent definitions
310

411
## None

packages/luis/test/fixtures/verified/regexmodel.lu

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11

2+
> LUIS application information
3+
> !# @app.name = regexEntity
4+
> !# @app.versionId = 0.1
5+
> !# @app.culture = en-us
6+
> !# @app.luis_schema_version = 3.2.0
7+
8+
29
> # Intent definitions
310

411
> # Entity definitions

0 commit comments

Comments
 (0)