Skip to content

Commit

Permalink
all tasks working
Browse files Browse the repository at this point in the history
  • Loading branch information
elenifysikoudi committed Oct 1, 2024
1 parent 20a248c commit 3340379
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 17 deletions.
11 changes: 2 additions & 9 deletions src/nlug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
21 changes: 15 additions & 6 deletions src/rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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]
})
}
},
Expand Down
4 changes: 2 additions & 2 deletions test/dme.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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?" },

]);
});
Expand Down

0 comments on commit 3340379

Please sign in to comment.