Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/dme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ export const dme = setup({
isuTransition("DowndateQUD", "integrate_usr_ask"),
isuTransition("DowndateQUD", "integrate_answer"),
isuTransition("DowndateQUD", "integrate_greet"),
isuTransition("DowndateQUD", "integrate_no_input"),
{ target: "DowndateQUD" },
],
},
Expand Down
10 changes: 9 additions & 1 deletion src/is.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@ export const initialIS = (): InformationState => {
// Mapping from predicate to sort
favorite_food: "food",
booking_course: "course",
booking_day: "day",
};
const individuals: { [index: string]: string } = {
// Mapping from individual to sort
pizza: "food",
LT2319: "course",
friday: "day",
tuesday: "day",
};
return {
domain: {
Expand All @@ -27,6 +30,7 @@ export const initialIS = (): InformationState => {
type: "issue",
content: WHQ("booking_room"),
plan: [
findout(WHQ("booking_day")),
findout(WHQ("booking_course")),
consultDB(WHQ("booking_room")),
],
Expand All @@ -37,9 +41,13 @@ export const initialIS = (): InformationState => {
consultDB: (question, facts) => {
if (objectsEqual(question, WHQ("booking_room"))) {
const course = getFactArgument(facts, "booking_course");
if (course == "LT2319") {
const day = getFactArgument(facts, "booking_day");
if (course == "LT2319" && day == "friday") {
return { predicate: "booking_room", argument: "G212" };
}
if (course == "LT2319" && day == "tuesday") {
return { predicate: "booking_room", argument: "J440" };
}
}
return null;
},
Expand Down
25 changes: 25 additions & 0 deletions src/nlug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,19 @@ const nluMapping: NLUMapping = {
content: "LT2319",
},
],
friday: [
{
type: "answer",
content: "friday",
},
],
tuesday: [
{
type: "answer",
content: "tuesday",
},
],
"*no_input*": [],
};
const nlgMapping: NLGMapping = [
[{ type: "ask", content: WHQ("booking_course") }, "Which course?"],
Expand All @@ -55,6 +68,18 @@ const nlgMapping: NLGMapping = [
},
"The lecture is in G212.",
],
[{ type: "ask", content: WHQ("booking_day") }, "Which day?"],
[
{
type: "answer",
content: { predicate: "booking_room", argument: "J440" },
},
"The lecture is in J440.",
],
[
{ type: "icm:per:neg", content: null },
"I didn't hear anything from you.",
],
];

export function nlg(moves: Move[]): string {
Expand Down
11 changes: 11 additions & 0 deletions src/rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,17 @@ export const rules: Rules = {

/** TODO rule 2.8 integrate_sys_quit */

/** negative perception feedback - when no user input */
integrate_no_input: ({ is }) => {
// check if latest utterance is from user and has no moves (empty)
if (is.shared.lu!.speaker === "usr" && is.shared.lu!.moves.length === 0) {
return () => ({
...is,
next_moves: [{ type: "icm:per:neg", content: null }, ...is.next_moves],
});
}
},

/**
* DowndateQUD
*/
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export type Question = WhQuestion;
type WhQuestion = { type: "whq"; predicate: string };

interface OtherMove {
type: "greet" | "request";
type: "greet" | "request" | "icm:per:neg";
content: null | string;
}
interface AnswerMove {
Expand Down
45 changes: 45 additions & 0 deletions test/dme.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,54 @@ describe("DME tests", () => {
runTest([
{ speaker: "sys", message: "Hello! You can ask me anything!" },
{ speaker: "usr", message: "Where is the lecture?" },
{ speaker: "sys", message: "Which day?" },
{ speaker: "usr", message: "Friday" },
{ speaker: "sys", message: "Which course?" },
{ speaker: "usr", message: "Dialogue Systems 2" },
{ speaker: "sys", message: "The lecture is in G212." },
]);
});

describe("system answer from database - Friday", () => {
runTest([
{ speaker: "sys", message: "Hello! You can ask me anything!" },
{ speaker: "usr", message: "Where is the lecture?" },
{ speaker: "sys", message: "Which day?" },
{ speaker: "usr", message: "Friday" },
{ speaker: "sys", message: "Which course?" },
{ speaker: "usr", message: "Dialogue Systems 2" },
{ speaker: "sys", message: "The lecture is in G212." },
]);
});

describe("system answer from database - Tuesday", () => {
runTest([
{ speaker: "sys", message: "Hello! You can ask me anything!" },
{ speaker: "usr", message: "Where is the lecture?" },
{ speaker: "sys", message: "Which day?" },
{ speaker: "usr", message: "Tuesday" },
{ speaker: "sys", message: "Which course?" },
{ speaker: "usr", message: "Dialogue Systems 2" },
{ speaker: "sys", message: "The lecture is in J440." },
]);
});

describe("Negative system contact feedback", () => {
runTest([
{ speaker: "sys", message: "Hello! You can ask me anything!" },
{ speaker: "usr", message: "*no_input*" },
{ speaker: "sys", message: "I didn't hear anything from you." },
]);
});

describe("Negative feedback followed by repeated question", () => {
runTest([
{ speaker: "sys", message: "Hello! You can ask me anything!" },
{ speaker: "usr", message: "Where is the lecture?" },
{ speaker: "sys", message: "Which day?" },
{ speaker: "usr", message: "*no_input*" },
{ speaker: "sys", message: "I didn't hear anything from you. Which day?" },
]);
});

});