diff --git a/src/nlug.ts b/src/nlug.ts index cd6c88c..81c5088 100644 --- a/src/nlug.ts +++ b/src/nlug.ts @@ -38,20 +38,13 @@ const nluMapping: NLUMapping = { "thursday": [{ type: "answer", content: "thurday", - }], - - "negative" : [{ - type : "NLUFail", - content : "I don't understand" - }], - - + }] }; const nlgMapping: NLGMapping = [ [{ type: "ask", content: WHQ("booking_course") }, "Which course?"], [{type: "ask",content : WHQ("course_day")},"What day is the lecture?"], [{ type: "greet", content: null }, "Hello! You can ask me anything!"], - [{type: "NLUFail",content:null},"I don't understand."], + [{type: "NLUFail",content:null},"Sorry, I didn't understand."], [ { type: "answer", diff --git a/src/rules.ts b/src/rules.ts index 881061b..d08a87a 100644 --- a/src/rules.ts +++ b/src/rules.ts @@ -261,15 +261,24 @@ export const rules: Rules = { ) { const q = is.private.agenda[0].content as Question; if (is.private.plan[0] && is.private.plan[0].type === "raise") { + newIS = { ...is, next_moves: [ ...is.next_moves, { type: "ask", content: q } ], private: { ...is.private, plan: [...is.private.plan.slice(1)] }, }; - } else { + } + if (is.shared.qud.length >0 && Array.isArray(is.shared.lu?.moves) && is.shared.lu?.moves.length === 0) { + const NLUFail = {type: "NLUFail", content : null } as Move ; newIS = { ...is, - next_moves: [ ...is.next_moves, { type: "ask", content: q } ], + next_moves: [ ...is.next_moves, NLUFail, { type: "ask", content: q } ], + }; + } + else { + newIS = { + ...is, + next_moves: [ ...is.next_moves, { type: "ask", content: q } ], }; } return () => newIS; @@ -322,14 +331,14 @@ export const rules: Rules = { negative_feedback : ({is}) => { if (Array.isArray(is.shared.lu?.moves) && is.shared.lu?.moves.length === 0) { const NLUFail = {type: "NLUFail", content : null } as Move ; - const moves = [NLUFail] ; - if (is.shared.qud.length>0) { + /*const moves = [NLUFail] ; ; + if (is.shared.qud.length >0) { const repeatQuestion = {type: "ask", content : is.shared.qud[0]} as Move ; moves.push(repeatQuestion) - } + console.log (`----------------${moves}------------`) ;*/ return () => ({ ...is, - next_moves : [...is.next_moves, moves[0] && moves[1]] + next_moves : [...is.next_moves, NLUFail] }) } }, diff --git a/test/dme.test.ts b/test/dme.test.ts index 6499266..fe178ea 100644 --- a/test/dme.test.ts +++ b/test/dme.test.ts @@ -148,11 +148,11 @@ describe("DME tests", () => { runTest([ { speaker: "sys", message: "Hello! You can ask me anything!" }, { speaker: "usr", message: "blabla"}, - { speaker: "sys", message: "I don't understand." }, + { speaker: "sys", message: "Sorry, I didn't understand." }, { speaker: "usr", message: "Where is the lecture?" }, { speaker: "sys", message: "Which course?" }, { speaker: "usr", message: "blabla"}, - { speaker: "sys", message: "I don't understand.Which course?" }, + { speaker: "sys", message: "Sorry, I didn't understand. Which course?" }, ]); });