// -*- mode: js; indent-tabs-mode: nil; js-basic-offset: 4 -*- // // This file is part of Genie // // Copyright 2020 The Board of Trustees of the Leland Stanford Junior University // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // Author: Giovanni Campagna // Shared templates and utilities, mostly collecting actual phrases or groups of phrases // rather than complex logic import * as $runtime from "../../sentence-generator/runtime"; import type $SentenceGenerator from "../../sentence-generator/generator"; import * as $SentenceGeneratorTypes from "../../sentence-generator/types"; import * as $I18n from "../../i18n/index"; import { Ast, } from 'thingtalk'; import * as C from '../ast_manip'; import ThingpediaLoader from '../load-thingpedia'; export const counterproposal_preamble : $SentenceGeneratorTypes.NonTerminal = "counterproposal_preamble"; export const the_base_noun_phrase : $SentenceGeneratorTypes.NonTerminal = "the_base_noun_phrase"; export const generic_excitement_phrase : $SentenceGeneratorTypes.NonTerminal = "generic_excitement_phrase"; export const generic_excitement2_phrase : $SentenceGeneratorTypes.NonTerminal = "generic_excitement2_phrase"; export const greeting : $SentenceGeneratorTypes.NonTerminal = "greeting"; export const generic_negative_proposal_reply : $SentenceGeneratorTypes.NonTerminal = "generic_negative_proposal_reply"; export const accept_phrase : $SentenceGeneratorTypes.NonTerminal = "accept_phrase"; export const reject_phrase : $SentenceGeneratorTypes.NonTerminal = "reject_phrase"; export const tell_me_more_phrase : $SentenceGeneratorTypes.NonTerminal = "tell_me_more_phrase"; export const learn_more_offer : $SentenceGeneratorTypes.NonTerminal = "learn_more_offer"; export const yes_please_phrase : $SentenceGeneratorTypes.NonTerminal = "yes_please_phrase"; export const ok_thanks_phrase : $SentenceGeneratorTypes.NonTerminal = "ok_thanks_phrase"; export const thanks_phrase : $SentenceGeneratorTypes.NonTerminal = "thanks_phrase"; export const no_thanks_phrase : $SentenceGeneratorTypes.NonTerminal = "no_thanks_phrase"; export const anything_else_phrase : $SentenceGeneratorTypes.NonTerminal = "anything_else_phrase"; export const sorry_preamble : $SentenceGeneratorTypes.NonTerminal = "sorry_preamble"; export const nevermind_phrase : $SentenceGeneratorTypes.NonTerminal = "nevermind_phrase"; export const ask_recommend_phrase : $SentenceGeneratorTypes.NonTerminal = "ask_recommend_phrase"; export const generic_dontcare_phrase : $SentenceGeneratorTypes.NonTerminal = "generic_dontcare_phrase"; export const no_dontcare_phrase : $SentenceGeneratorTypes.NonTerminal = "no_dontcare_phrase"; export const prefer_question_phrase : $SentenceGeneratorTypes.NonTerminal = "prefer_question_phrase"; export const system_learn_more : $SentenceGeneratorTypes.NonTerminal = "system_learn_more"; export const repeat_command_phrase : $SentenceGeneratorTypes.NonTerminal = "repeat_command_phrase"; export const repeat_command_on_error_phrase : $SentenceGeneratorTypes.NonTerminal = "repeat_command_on_error_phrase"; export const make_monitor_phrase : $SentenceGeneratorTypes.NonTerminal = "make_monitor_phrase"; /** * Load the templates in this file. * * This is an autogenerated method that will be called by the {@link SentenceGenerator} * when the templates are imported. */ export async function $load($options : $SentenceGeneratorTypes.GrammarOptions, $locale : $I18n.LanguagePack, $grammar : $SentenceGenerator, $loader : ThingpediaLoader) : Promise { $grammar.declareSymbol("counterproposal_preamble"); $grammar.addRule("counterproposal_preamble", [], $locale._("{i was thinking more of|i would like|i am looking for|do you have|can you find|is there [plural=one]|are there [plural=other]|that does not sound great , do you have}"), (() : (string)|null => ''), undefined, { }); $grammar.declareSymbol("the_base_noun_phrase"); $grammar.addRule("the_base_noun_phrase", [new $runtime.NonTerminal("base_noun_phrase", "noun", undefined)], $locale._("{the|that} ${noun} [plural=noun[plural]]"), ((noun : Ast.FunctionDef) : (Ast.FunctionDef)|null => noun), C.functionDefKeyFn, { }); $grammar.declareSymbol("generic_excitement_phrase"); $grammar.addRule("generic_excitement_phrase", [], '', (() : (string)|null => ''), undefined, { priority: (0.1) }); $grammar.addRule("generic_excitement_phrase", [], $locale._("{alright,| great!|awesome !|sounds good !|sounds good ,|perfect !}"), (() : (string)|null => ''), undefined, { }); $grammar.declareSymbol("generic_excitement2_phrase"); $grammar.addRule("generic_excitement2_phrase", [], $locale._("{alright,| great!|awesome !|sounds good !|sounds good ,|perfect !}"), (() : (string)|null => ''), undefined, { }); $grammar.declareSymbol("greeting"); $grammar.addRule("greeting", [], $locale._("{hello !|hi !}"), (() : (string)|null => ''), undefined, { }); $grammar.declareSymbol("generic_negative_proposal_reply"); $grammar.addRule("generic_negative_proposal_reply", [], $locale._("{i do not like that|i do not like that , do you have any other option ?}"), (() : (string)|null => ''), undefined, { }); $grammar.declareSymbol("accept_phrase"); $grammar.addRule("accept_phrase", [], $locale._("{i like that|yes i like that|sure i like that|sounds good}"), (() : (string)|null => ''), undefined, { }); $grammar.declareSymbol("reject_phrase"); $grammar.addRule("reject_phrase", [], $locale._("{no|actually , no|that will not work|no , thank you|not yet|actually , not yet}"), (() : (string)|null => ''), undefined, { }); $grammar.declareSymbol("tell_me_more_phrase"); $grammar.addRule("tell_me_more_phrase", [], $locale._("{can you tell me more ?|can you tell me more about it ?|can you give me more info ?|give me more info !|give me more information .|tell me more .}"), (() : (string)|null => ''), undefined, { }); $grammar.declareSymbol("learn_more_offer"); $grammar.addRule("learn_more_offer", [], $locale._("{would you like to {learn more|{know|hear} more about it}|are you interested to hear more about it}"), (() : (string)|null => ''), undefined, { priority: (0.1) }); $grammar.declareSymbol("yes_please_phrase"); $grammar.addRule("yes_please_phrase", [], $locale._("{yes|yes , please|yeah}"), (() : (string)|null => ''), undefined, { }); $grammar.declareSymbol("ok_thanks_phrase"); $grammar.addRule("ok_thanks_phrase", [], $locale._("{ok {thank you|thanks} that is all i need.}"), (() : (string)|null => ''), undefined, { }); $grammar.declareSymbol("thanks_phrase"); $grammar.addRule("thanks_phrase", [], $locale._("{{thank you|thanks} {,|} {that will be all|that will be all for now|this is good for now|this is what i need} .|thank your for your help{!|, this is what i needed.}}"), (() : (string)|null => ''), undefined, { }); $grammar.declareSymbol("no_thanks_phrase"); $grammar.addRule("no_thanks_phrase", [], $locale._("{no thanks|no, thanks|no i am good thanks|no need thanks|no {thank you|thanks} {,|} {this is good for now|this is all i need|that will be it|this will do|that will be it for now|this will do for now|that will be all}.}"), (() : (string)|null => ''), undefined, { }); $grammar.declareSymbol("anything_else_phrase"); $grammar.addRule("anything_else_phrase", [], $locale._("{is there anything else i can help you with|can i help you with anything else|do you need anything else|anything else for you today}?"), (() : (string)|null => ''), undefined, { }); $grammar.declareSymbol("sorry_preamble"); $grammar.addRule("sorry_preamble", [], $locale._("{sorry,|i am sorry,|}"), (() : (string)|null => ''), undefined, { }); $grammar.declareSymbol("nevermind_phrase"); $grammar.addRule("nevermind_phrase", [], $locale._("{ok, never mind|never mind then|alright, never mind|too bad, alright}"), (() : (string)|null => ''), undefined, { }); $grammar.declareSymbol("ask_recommend_phrase"); $grammar.addRule("ask_recommend_phrase", [], $locale._("{which {one|1} would you recommend?|what is your favorite?|surprise me! just pick one please.}"), (() : (string)|null => ''), undefined, { }); $grammar.declareSymbol("generic_dontcare_phrase"); $grammar.addRule("generic_dontcare_phrase", [], $locale._("{it does not matter. {|can you suggest one?}|i {do not have a|have no} preference. {|what do you recommend?}|i have no preference. {please make a recommendation|which {one|1} is best?}}"), (() : (string)|null => ''), undefined, { }); $grammar.declareSymbol("no_dontcare_phrase"); $grammar.addRule("no_dontcare_phrase", [], $locale._("{no {.|,} {can you suggest one|please make a recommendation|which {one|1} is best?|you choose for me!|surprise me!}|i have no preference. please make a recommendation.}"), (() : (string)|null => ''), undefined, { }); $grammar.declareSymbol("prefer_question_phrase"); $grammar.addRule("prefer_question_phrase", [], $locale._("{do you want|would you prefer|would you like|are you interested in|are you looking for}"), (() : (string)|null => ''), undefined, { }); $grammar.declareSymbol("system_learn_more"); $grammar.addRule("system_learn_more", [], $locale._("what would you like to {know|hear}?"), (() : (string)|null => ''), undefined, { }); $grammar.declareSymbol("repeat_command_phrase"); $grammar.addRule("repeat_command_phrase", [], $locale._("{again !|another one|do this again|do it again|do the last command}"), (() : (string)|null => ''), undefined, { }); $grammar.declareSymbol("repeat_command_on_error_phrase"); $grammar.addRule("repeat_command_on_error_phrase", [], $locale._("{please|} {try again|try this again|do the last command|do it again}"), (() : (string)|null => ''), undefined, { }); $grammar.declareSymbol("make_monitor_phrase"); $grammar.addRule("make_monitor_phrase", [], $locale._("{ok|great|i like that|yes i like that|sure i like that|sounds good} {,|} {notify me when it changes|notify me when it changes|subscribe to changes|let me know of changes|notify me of this|subscribe to this}"), (() : (string)|null => ''), undefined, { }); };