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

Commit 92dfb46

Browse files
author
Shuai Wang
authored
Support extracting more modelTypeId in luis:test command (#1229)
* support all modelTypeId * change valid modelTypeId * modify test * retrigger
1 parent 4cdd4d9 commit 92dfb46

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

packages/lu/src/parser/test/testhelper.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ function compareEntity(predictedEntities: any[], utterance: any) {
8989
let pass = true
9090
for (const entity of utterance.entities) {
9191
if (!predictedEntities.find((x: any) =>
92-
(entity.role !== undefined && entity.role === x.role || entity.role === undefined && entity.entity === x.entity)
92+
((entity.role !== undefined && entity.role === x.role) || (entity.role === undefined && entity.entity === x.entity))
9393
&& entity.startPos === x.startPos
9494
&& entity.endPos === x.endPos)) {
9595
pass = false
@@ -105,7 +105,7 @@ function ParseEntitiyResult(entities: any, result: any) {
105105
if (name === '$instance') {
106106
for (const entityType of Object.keys(entities.$instance)) {
107107
for (const entity of entities.$instance[entityType]) {
108-
if (entity.modelTypeId === 1 || entity.modelTypeId === 4 || (entity.role !== undefined && entity.role !== '')) {
108+
if (entity.modelTypeId === 1 || entity.modelTypeId === 4 || entity.modelTypeId === 10 || entity.role) {
109109
let newEntity: any = new Object()
110110
newEntity.entity = entityType
111111
newEntity.startPos = entity.startIndex

packages/luis/test/commands/luis/test.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ describe('luis:test normal test', () => {
282282
nock('https://westus.api.cognitive.microsoft.com')
283283
.post(uri => uri.includes('apps'))
284284
.reply(200, {
285-
"query":"create a event with eden roth at 4pm today for 30 mins","prediction":{"topIntent":"CreateCalendarEntry","intents":{"CreateCalendarEntry":{"score":0.9999999},"None":{"score":4.94949234e-7},"FindCalendarEntry":{"score":4.29645354e-7},"AcceptEventEntry":{"score":3.24675227e-7}},"entities":{"FromTime":["4pm"],"FromDate":["today"],"Duration":["30 mins"],"$instance":{"FromTime":[{"type":"FromTime","text":"4pm","startIndex":33,"length":3,"score":0.9858761,"modelTypeId":1,"modelType":"Entity Extractor","recognitionSources":["model"]}],"FromDate":[{"type":"FromDate","text":"today","startIndex":37,"length":5,"score":0.9848769,"modelTypeId":1,"modelType":"Entity Extractor","recognitionSources":["model"]}],"Duration":[{"type":"Duration","text":"30 mins","startIndex":47,"length":7,"score":0.978632748,"modelTypeId":1,"modelType":"Entity Extractor","recognitionSources":["model"]}]}}}
285+
"query":"create a event with eden roth at 4pm today for 30 mins","prediction":{"topIntent":"CreateCalendarEntry","intents":{"CreateCalendarEntry":{"score":0.9999999},"None":{"score":4.94949234e-7},"FindCalendarEntry":{"score":4.29645354e-7},"AcceptEventEntry":{"score":3.24675227e-7}},"entities":{"FromTime":["4pm"],"FromDate":["today"],"Duration":["30 mins"],"$instance":{"FromTime":[{"type":"FromTime","text":"4pm","startIndex":33,"length":3,"score":0.9858761,"modelTypeId":10,"modelType":"Entity Extractor","recognitionSources":["model"]}],"FromDate":[{"type":"FromDate","text":"today","startIndex":37,"length":5,"score":0.9848769,"modelTypeId":1,"modelType":"Entity Extractor","recognitionSources":["model"]}],"Duration":[{"type":"Duration","text":"30 mins","startIndex":47,"length":7,"score":0.978632748,"modelTypeId":1,"modelType":"Entity Extractor","recognitionSources":["model"]}]}}}
286286
})
287287

288288
nock('https://westus.api.cognitive.microsoft.com')

0 commit comments

Comments
 (0)