// -*- mode: typescript; 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 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 * as D from './dialogue_acts'; import ThingpediaLoader from './load-thingpedia'; import { $load as $load___constants,at_time, constant_date_point, constant_date_range, constant_day_of_week, unit_Measure_ms, constant_pairs, constant_or_pairs, constant_nor_pairs, constant_String_ContextRef } from "./constants.genie.out"; export { at_time, constant_date_point, constant_date_range, constant_day_of_week, unit_Measure_ms, constant_pairs, constant_or_pairs, constant_nor_pairs, constant_String_ContextRef }; export const bookkeeping : $SentenceGeneratorTypes.NonTerminal = "bookkeeping"; export const $root : $SentenceGeneratorTypes.NonTerminal = "$root"; /** * 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 { function special(specialType : string) { return new Ast.ControlCommand(null, new Ast.SpecialControlIntent(null, specialType)); } await $load___constants($options, $locale, $grammar, $loader); $grammar.declareSymbol("bookkeeping"); $grammar.addRule("bookkeeping", [], $locale._("debug"), (() : (Ast.ControlCommand)|null => special('debug')), undefined, { }); $grammar.addRule("bookkeeping", [], $locale._("cancel"), (() : (Ast.ControlCommand)|null => special('nevermind')), undefined, { }); $grammar.addRule("bookkeeping", [], $locale._("never mind"), (() : (Ast.ControlCommand)|null => special('nevermind')), undefined, { }); $grammar.addRule("bookkeeping", [], $locale._("stop"), (() : (Ast.ControlCommand)|null => special('stop')), undefined, { }); $grammar.addRule("bookkeeping", [], $locale._("stop it"), (() : (Ast.ControlCommand)|null => special('stop')), undefined, { }); $grammar.addRule("bookkeeping", [], $locale._("shut up"), (() : (Ast.ControlCommand)|null => special('stop')), undefined, { }); $grammar.addRule("bookkeeping", [], $locale._("stop . stop"), (() : (Ast.ControlCommand)|null => special('stop')), undefined, { }); $grammar.addRule("bookkeeping", [], $locale._("stopped"), (() : (Ast.ControlCommand)|null => special('stop')), undefined, { }); $grammar.addRule("bookkeeping", [], $locale._("shush"), (() : (Ast.ControlCommand)|null => special('stop')), undefined, { }); $grammar.addRule("bookkeeping", [], $locale._("quiet"), (() : (Ast.ControlCommand)|null => special('stop')), undefined, { }); $grammar.addRule("bookkeeping", [], $locale._("close"), (() : (Ast.ControlCommand)|null => special('stop')), undefined, { }); $grammar.addRule("bookkeeping", [], $locale._("yes"), (() : (Ast.ControlCommand)|null => special('yes')), undefined, { }); $grammar.addRule("bookkeeping", [], $locale._("yes please"), (() : (Ast.ControlCommand)|null => special('yes')), undefined, { }); $grammar.addRule("bookkeeping", [], $locale._("yes , please"), (() : (Ast.ControlCommand)|null => special('yes')), undefined, { }); $grammar.addRule("bookkeeping", [], $locale._("yeah"), (() : (Ast.ControlCommand)|null => special('yes')), undefined, { }); $grammar.addRule("bookkeeping", [], $locale._("ok"), (() : (Ast.ControlCommand)|null => special('yes')), undefined, { }); $grammar.addRule("bookkeeping", [], $locale._("okay"), (() : (Ast.ControlCommand)|null => special('yes')), undefined, { }); $grammar.addRule("bookkeeping", [], $locale._("yes yes"), (() : (Ast.ControlCommand)|null => special('yes')), undefined, { }); $grammar.addRule("bookkeeping", [], $locale._("yes . yes"), (() : (Ast.ControlCommand)|null => special('yes')), undefined, { }); $grammar.addRule("bookkeeping", [], $locale._("no"), (() : (Ast.ControlCommand)|null => special('no')), undefined, { }); $grammar.addRule("bookkeeping", [], $locale._("no thanks"), (() : (Ast.ControlCommand)|null => special('no')), undefined, { }); $grammar.addRule("bookkeeping", [], $locale._("no , thanks"), (() : (Ast.ControlCommand)|null => special('no')), undefined, { }); $grammar.addRule("bookkeeping", [], $locale._("nope"), (() : (Ast.ControlCommand)|null => special('no')), undefined, { }); $grammar.addRule("bookkeeping", [], $locale._("no no"), (() : (Ast.ControlCommand)|null => special('no')), undefined, { }); $grammar.addRule("bookkeeping", [], $locale._("no . no"), (() : (Ast.ControlCommand)|null => special('no')), undefined, { }); $grammar.addRule("bookkeeping", [new $runtime.NonTerminal("constant_Any", "c", undefined)], "${c}", ((c : Ast.Value) : (Ast.ControlCommand)|null => { if (c.isEnum) return null; return new Ast.ControlCommand(null, new Ast.AnswerControlIntent(null, c)); }), undefined, { }); $grammar.declareSymbol("$root"); $grammar.addRule("$root", [new $runtime.NonTerminal("bookkeeping", undefined, undefined)], "${bookkeeping}", (($0 : Ast.ControlCommand) : (Ast.Input)|null => { return $0; }), undefined, { identity: (true) }); if (!$options.flags.dialogues) { $grammar.addRule("$root", [new $runtime.NonTerminal("thingpedia_complete_query", "query", undefined)], $locale._("get ${query}"), ((query : Ast.Expression) : (Ast.Input)|null => C.makeProgram($loader, query)), undefined, { }); $grammar.addRule("$root", [new $runtime.NonTerminal("thingpedia_complete_query", "query", undefined)], $locale._("show me ${query}"), ((query : Ast.Expression) : (Ast.Input)|null => C.makeProgram($loader, query)), undefined, { }); $grammar.addRule("$root", [new $runtime.NonTerminal("thingpedia_complete_get_command", "query", undefined)], "${query}", ((query : Ast.Expression) : (Ast.Input)|null => C.makeProgram($loader, query)), undefined, { }); $grammar.addRule("$root", [new $runtime.NonTerminal("thingpedia_complete_action", "action", undefined)], "${action}", ((action : Ast.Expression) : (Ast.Input)|null => C.makeProgram($loader, action)), undefined, { }); $grammar.addRule("$root", [new $runtime.NonTerminal("thingpedia_complete_stream", "stream", undefined)], $locale._("notify me ${stream}"), ((stream : Ast.Expression) : (Ast.Input)|null => C.makeProgram($loader, stream)), undefined, { }); } if ($options.flags.dialogues) { $grammar.addRule("$root", [new $runtime.NonTerminal("thingpedia_complete_query", "query", undefined)], $locale._("get ${query}"), ((query : Ast.Expression) : (Ast.Input)|null => D.initialRequest($loader, query)), undefined, { }); $grammar.addRule("$root", [new $runtime.NonTerminal("thingpedia_complete_query", "query", undefined)], $locale._("show me ${query}"), ((query : Ast.Expression) : (Ast.Input)|null => D.initialRequest($loader, query)), undefined, { }); $grammar.addRule("$root", [new $runtime.NonTerminal("thingpedia_complete_get_command", "query", undefined)], "${query}", ((query : Ast.Expression) : (Ast.Input)|null => D.initialRequest($loader, query)), undefined, { }); $grammar.addRule("$root", [new $runtime.NonTerminal("thingpedia_complete_action", "action", undefined)], "${action}", ((action : Ast.Expression) : (Ast.Input)|null => D.initialRequest($loader, action)), undefined, { }); $grammar.addRule("$root", [new $runtime.NonTerminal("thingpedia_complete_stream", "stream", undefined)], $locale._("notify me ${stream}"), ((stream : Ast.Expression) : (Ast.Input)|null => D.initialRequest($loader, stream)), undefined, { }); } };