// -*- 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 S from './state_manip'; import * as D from './dialogue_acts'; import ThingpediaLoader from './load-thingpedia'; import { $load as $load___shared, } from "./shared.genie.out"; export { }; 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 }; import { $load as $load___timers,timer } from "./timers.genie.out"; export { timer }; import { $load as $load___filters,get_predicate_filter, if_filter, edge_filter, either_filter, range, range_filter, with_filter, range_with_filter, nearby_filter, whose_npp_filter, quality_filter, within_filter } from "./filters.genie.out"; export { get_predicate_filter, if_filter, edge_filter, either_filter, range, range_filter, with_filter, range_with_filter, nearby_filter, whose_npp_filter, quality_filter, within_filter }; import { $load as $load___projections,the_out_param_pair, the_out_param_triple, pair_projection, where_question, boolean_projection, verb_projection_Any } from "./projections.genie.out"; export { the_out_param_pair, the_out_param_triple, pair_projection, where_question, boolean_projection, verb_projection_Any }; import { $load as $load___aggregation,projection_Number } from "./aggregation.genie.out"; export { projection_Number }; import { $load as $load___computation,projection_Measure_m, compute_question } from "./computation.genie.out"; export { projection_Measure_m, compute_question }; import { $load as $load___who_questions,who_complete_table, who_with_filtered_table, who_one_with_filter_table, who_one_which_filter_table, who_one_clean_filter_table, who_two_with_filter_table, who_two_which_filter_table, who_two_clean_filter_table, who_verb_filtered_table, who_one_be_filter_table, who_one_have_filter_table, who_one_verb_filter_table, who_two_be_filter_table, who_two_have_filter_table, who_two_verb_filter_table, whose_filtered_table } from "./who_questions.genie.out"; export { who_complete_table, who_with_filtered_table, who_one_with_filter_table, who_one_which_filter_table, who_one_clean_filter_table, who_two_with_filter_table, who_two_which_filter_table, who_two_clean_filter_table, who_verb_filtered_table, who_one_be_filter_table, who_one_have_filter_table, who_one_verb_filter_table, who_two_be_filter_table, who_two_have_filter_table, who_two_verb_filter_table, whose_filtered_table }; import { $load as $load___stream_tables,complete_table, complete_get_command, if_filtered_table, one_if_filter_table, two_if_filter_table, answer_noun_phrase, one_with_filter_table, one_which_filter_table, one_clean_filter_table, two_with_filter_table, two_which_filter_table, two_clean_filter_table, three_with_filter_table, three_which_filter_table, three_clean_filter_table, anything_phrase, anything_with_filter_phrase, anything_which_filter_phrase, anything_clean_filter_phrase, verb_filtered_table, one_be_filter_table, one_have_filter_table, one_verb_filter_table, two_be_filter_table, two_have_filter_table, two_verb_filter_table, generic_argminmax, have_arg_min_max_table, edge_stream, stream, with_filtered_table_join, have_filtered_table_join } from "./stream_tables.genie.out"; export { complete_table, complete_get_command, if_filtered_table, one_if_filter_table, two_if_filter_table, answer_noun_phrase, one_with_filter_table, one_which_filter_table, one_clean_filter_table, two_with_filter_table, two_which_filter_table, two_clean_filter_table, three_with_filter_table, three_which_filter_table, three_clean_filter_table, anything_phrase, anything_with_filter_phrase, anything_which_filter_phrase, anything_clean_filter_phrase, verb_filtered_table, one_be_filter_table, one_have_filter_table, one_verb_filter_table, two_be_filter_table, two_have_filter_table, two_verb_filter_table, generic_argminmax, have_arg_min_max_table, edge_stream, stream, with_filtered_table_join, have_filtered_table_join }; import { $load as $load___commands,forward_get_do_command, backward_get_do_command, forward_when_do_rule, backward_when_do_rule, when_get_stream, when_get_do_rule, timer_rule, generic_preamble_for_answer, generic_preamble_for_action, generic_verb_for_search, imperative_verb_for_search, generic_search_preamble, generic_lookup_preamble, generic_article, search_command, complete_question, projection_question, explicit_when_condition, when_command, monitor_command, complete_action, say_command } from "./commands.genie.out"; export { forward_get_do_command, backward_get_do_command, forward_when_do_rule, backward_when_do_rule, when_get_stream, when_get_do_rule, timer_rule, generic_preamble_for_answer, generic_preamble_for_action, generic_verb_for_search, imperative_verb_for_search, generic_search_preamble, generic_lookup_preamble, generic_article, search_command, complete_question, projection_question, explicit_when_condition, when_command, monitor_command, complete_action, say_command }; import { $load as $load___dlg_shared,counterproposal_preamble, the_base_noun_phrase, generic_excitement_phrase, generic_excitement2_phrase, greeting, generic_negative_proposal_reply, accept_phrase, reject_phrase, tell_me_more_phrase, learn_more_offer, yes_please_phrase, ok_thanks_phrase, thanks_phrase, no_thanks_phrase, anything_else_phrase, sorry_preamble, nevermind_phrase, ask_recommend_phrase, generic_dontcare_phrase, no_dontcare_phrase, prefer_question_phrase, system_learn_more, repeat_command_phrase, repeat_command_on_error_phrase, make_monitor_phrase } from "./dlg/shared.genie.out"; export { counterproposal_preamble, the_base_noun_phrase, generic_excitement_phrase, generic_excitement2_phrase, greeting, generic_negative_proposal_reply, accept_phrase, reject_phrase, tell_me_more_phrase, learn_more_offer, yes_please_phrase, ok_thanks_phrase, thanks_phrase, no_thanks_phrase, anything_else_phrase, sorry_preamble, nevermind_phrase, ask_recommend_phrase, generic_dontcare_phrase, no_dontcare_phrase, prefer_question_phrase, system_learn_more, repeat_command_phrase, repeat_command_on_error_phrase, make_monitor_phrase }; import { $load as $load___dlg_results,direct_answer_phrase, direct_answer_phrase_0, direct_answer_phrase_1, direct_answer_phrase_2, direct_answer_phrase_3, direct_result_info_phrase, one_param_direct_result_info_phrase, two_param_direct_result_info_phrase, three_param_direct_result_info_phrase, four_param_direct_result_info_phrase, result_info_phrase, base_result_phrase, equal_with_filter, one_with_info_phrase, one_which_info_phrase, one_clean_info_phrase, two_with_info_phrase, two_which_info_phrase, two_clean_info_phrase, three_with_info_phrase, three_which_info_phrase, three_clean_info_phrase, n_with_info_phrase, n_which_info_phrase, n_clean_info_phrase } from "./dlg/results.genie.out"; export { direct_answer_phrase, direct_answer_phrase_0, direct_answer_phrase_1, direct_answer_phrase_2, direct_answer_phrase_3, direct_result_info_phrase, one_param_direct_result_info_phrase, two_param_direct_result_info_phrase, three_param_direct_result_info_phrase, four_param_direct_result_info_phrase, result_info_phrase, base_result_phrase, equal_with_filter, one_with_info_phrase, one_which_info_phrase, one_clean_info_phrase, two_with_info_phrase, two_which_info_phrase, two_clean_info_phrase, three_with_info_phrase, three_which_info_phrase, three_clean_info_phrase, n_with_info_phrase, n_which_info_phrase, n_clean_info_phrase }; import { $load as $load___dlg_coref_actions,coref_action_phrase, list_coref_action_phrase, contextual_action_phrase, action_coref_recommendation, action_coref_list_proposal, coref_action_command, action_by_name_command, action_continuation_command, continuation_query, action_description_phrase } from "./dlg/coref-actions.genie.out"; export { coref_action_phrase, list_coref_action_phrase, contextual_action_phrase, action_coref_recommendation, action_coref_list_proposal, coref_action_command, action_by_name_command, action_continuation_command, continuation_query, action_description_phrase }; import { $load as $load___dlg_action_confirm,action_confirm_phrase } from "./dlg/action-confirm.genie.out"; export { action_confirm_phrase }; import { $load as $load___dlg_action_results,complete_past_action_phrase, generic_action_success_phrase, action_success_phrase_with_result, action_success_phrase, action_notification_phrase, short_action_error_message, long_action_error_message, one_param_try_different_param_question, two_param_try_different_param_question, action_error_phrase } from "./dlg/action-results.genie.out"; export { complete_past_action_phrase, generic_action_success_phrase, action_success_phrase_with_result, action_success_phrase, action_notification_phrase, short_action_error_message, long_action_error_message, one_param_try_different_param_question, two_param_try_different_param_question, action_error_phrase }; import { $load as $load___dlg_aggregation_results,count_aggregation_reply, agg_operator_for_reply, other_aggregation_reply } from "./dlg/aggregation-results.genie.out"; export { count_aggregation_reply, agg_operator_for_reply, other_aggregation_reply }; import { $load as $load___dlg_coref_questions,out_param_list_for_coref_question, simple_user_search_question, simple_user_search_question_for_list, boolean_user_search_question, boolean_user_search_question_for_list, user_search_question_with_name, boolean_user_search_question_with_name, user_search_question, user_search_question_for_list } from "./dlg/coref-questions.genie.out"; export { out_param_list_for_coref_question, simple_user_search_question, simple_user_search_question_for_list, boolean_user_search_question, boolean_user_search_question_for_list, user_search_question_with_name, boolean_user_search_question_with_name, user_search_question, user_search_question_for_list }; import { $load as $load___dlg_empty_search,empty_search_error, precise_empty_search_change_request, imprecise_empty_search_change_request } from "./dlg/empty-search.genie.out"; export { empty_search_error, precise_empty_search_change_request, imprecise_empty_search_change_request }; import { $load as $load___dlg_initial_request,initial_command } from "./dlg/initial-request.genie.out"; export { initial_command }; import { $load as $load___dlg_list_proposal,system_list_proposal, concat_list_description, generic_list_proposal_accept_phrase, list_proposal_accept_phrase_must_have_action, list_proposal_accept_phrase_with_action, list_proposal_accept_phrase_with_action_by_name, list_proposal_tell_me_more, positive_list_proposal_reply } from "./dlg/list-proposal.genie.out"; export { system_list_proposal, concat_list_description, generic_list_proposal_accept_phrase, list_proposal_accept_phrase_must_have_action, list_proposal_accept_phrase_with_action, list_proposal_accept_phrase_with_action_by_name, list_proposal_tell_me_more, positive_list_proposal_reply }; import { $load as $load___dlg_recommendation,question_system_recommendation_short, action_recommendation, actionable_system_recommendation_short, proposal_info_action_pair, direct_user_question_answer, actionable_system_display_result_short, system_nonlist_result, system_recommendation, recommendation_accept_phrase_with_action, recommendation_accept_phrase_by_name } from "./dlg/recommendation.genie.out"; export { question_system_recommendation_short, action_recommendation, actionable_system_recommendation_short, proposal_info_action_pair, direct_user_question_answer, actionable_system_display_result_short, system_nonlist_result, system_recommendation, recommendation_accept_phrase_with_action, recommendation_accept_phrase_by_name }; import { $load as $load___dlg_refinement,search_result_preamble, system_generic_proposal, negative_proposal_request, negative_proposal_answer_preamble, negative_proposal_reply } from "./dlg/refinement.genie.out"; export { search_result_preamble, system_generic_proposal, negative_proposal_request, negative_proposal_answer_preamble, negative_proposal_reply }; import { $load as $load___dlg_related_questions,related_question } from "./dlg/related-questions.genie.out"; export { related_question }; import { $load as $load___dlg_search_questions,one_param_direct_search_question, one_param_direct_search_question_with_preamble, two_param_direct_search_question, one_param_yesno_direct_search_question, one_param_yesno_direct_search_question_with_preamble, two_param_yesno_direct_search_question, question_npp_filter_pair, question_apv_filter_pair, question_avp_filter_pair, question_preposition_filter_pair, question_pvp_filter_pair, disjunctive_search_question, generic_question, simple_search_question, search_question, verbose_search_answer, verbose_search_answer_with_action, precise_search_question_answer, specific_dontcare_phrase, imprecise_search_coref_answer, imprecise_search_answer_phrase, imprecise_search_answer, imprecise_search_question_answer } from "./dlg/search-questions.genie.out"; export { one_param_direct_search_question, one_param_direct_search_question_with_preamble, two_param_direct_search_question, one_param_yesno_direct_search_question, one_param_yesno_direct_search_question_with_preamble, two_param_yesno_direct_search_question, question_npp_filter_pair, question_apv_filter_pair, question_avp_filter_pair, question_preposition_filter_pair, question_pvp_filter_pair, disjunctive_search_question, generic_question, simple_search_question, search_question, verbose_search_answer, verbose_search_answer_with_action, precise_search_question_answer, specific_dontcare_phrase, imprecise_search_coref_answer, imprecise_search_answer_phrase, imprecise_search_answer, imprecise_search_question_answer }; import { $load as $load___dlg_slot_fill,one_param_slot_fill_question, two_param_slot_fill_question, slot_fill_question, imprecise_slot_fill_answer_phrase, imprecise_slot_fill_coref_answer, imprecise_slot_fill_answer, precise_slot_fill_answer } from "./dlg/slot-fill.genie.out"; export { one_param_slot_fill_question, two_param_slot_fill_question, slot_fill_question, imprecise_slot_fill_answer_phrase, imprecise_slot_fill_coref_answer, imprecise_slot_fill_answer, precise_slot_fill_answer }; import { $load as $load___dlg_streams,notification_preamble, notification_error_preamble, add_separate_stream_to_query, add_separate_stream } from "./dlg/streams.genie.out"; export { notification_preamble, notification_error_preamble, add_separate_stream_to_query, add_separate_stream }; export const initial_request_preamble : $SentenceGeneratorTypes.NonTerminal = "initial_request_preamble"; /** * The root of the agent generation. * * This non-terminal contains the entire reply of the agent. */ export const $agent : $SentenceGeneratorTypes.NonTerminal = "$agent"; /** * The root of the user generation. * * This non-terminal contains a single user turn in its entirety. */ export const $user : $SentenceGeneratorTypes.NonTerminal = "$user"; /** * 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 { await $load___shared($options, $locale, $grammar, $loader); await $load___constants($options, $locale, $grammar, $loader); await $load___timers($options, $locale, $grammar, $loader); await $load___filters($options, $locale, $grammar, $loader); await $load___projections($options, $locale, $grammar, $loader); await $load___aggregation($options, $locale, $grammar, $loader); await $load___computation($options, $locale, $grammar, $loader); await $load___who_questions($options, $locale, $grammar, $loader); await $load___stream_tables($options, $locale, $grammar, $loader); await $load___commands($options, $locale, $grammar, $loader); await $load___dlg_shared($options, $locale, $grammar, $loader); await $load___dlg_results($options, $locale, $grammar, $loader); await $load___dlg_coref_actions($options, $locale, $grammar, $loader); await $load___dlg_action_confirm($options, $locale, $grammar, $loader); await $load___dlg_action_results($options, $locale, $grammar, $loader); await $load___dlg_aggregation_results($options, $locale, $grammar, $loader); await $load___dlg_coref_questions($options, $locale, $grammar, $loader); await $load___dlg_empty_search($options, $locale, $grammar, $loader); await $load___dlg_initial_request($options, $locale, $grammar, $loader); await $load___dlg_list_proposal($options, $locale, $grammar, $loader); await $load___dlg_recommendation($options, $locale, $grammar, $loader); await $load___dlg_refinement($options, $locale, $grammar, $loader); await $load___dlg_related_questions($options, $locale, $grammar, $loader); await $load___dlg_search_questions($options, $locale, $grammar, $loader); await $load___dlg_slot_fill($options, $locale, $grammar, $loader); await $load___dlg_streams($options, $locale, $grammar, $loader); $grammar.declareContext("ctx_init"); $grammar.declareContext("ctx_multidomain"); $grammar.declareContext("ctx_with_result"); $grammar.declareContext("ctx_with_table_result"); $grammar.declareContext("ctx_with_aggregation_result"); $grammar.declareContext("ctx_with_action"); $grammar.declareContext("ctx_without_action"); $grammar.declareContext("ctx_with_result_and_action"); $grammar.declareContext("ctx_with_result_question"); $grammar.declareContext("ctx_with_result_noquestion"); $grammar.declareContext("ctx_with_result_argminmax"); $grammar.declareContext("ctx_without_projection"); $grammar.declareContext("ctx_with_notification"); $grammar.declareContext("ctx_for_related_question"); $grammar.declareContext("ctx_with_missing_projection"); $grammar.declareContext("ctx_next_statement"); $grammar.declareContext("ctx_current_statement"); $grammar.declareContext("ctx_greet"); $grammar.declareContext("ctx_reinit"); $grammar.declareContext("ctx_cancel"); $grammar.declareContext("ctx_end"); $grammar.declareContext("ctx_search_command"); $grammar.declareContext("ctx_aggregation_question"); $grammar.declareContext("ctx_distance_argminmax_question"); $grammar.declareContext("ctx_argminmax_question"); $grammar.declareContext("ctx_one_result_question"); $grammar.declareContext("ctx_empty_direct_question"); $grammar.declareContext("ctx_empty_search_command"); $grammar.declareContext("ctx_large_search_command"); $grammar.declareContext("ctx_single_result_search_command"); $grammar.declareContext("ctx_complete_search_command"); $grammar.declareContext("ctx_completed_action_success"); $grammar.declareContext("ctx_completed_action_error"); $grammar.declareContext("ctx_confirm_action"); $grammar.declareContext("ctx_incomplete_action"); $grammar.declareContext("ctx_incomplete_action_after_search"); $grammar.declareContext("ctx_learn_more"); $grammar.declareContext("ctx_display_nonlist_result"); $grammar.declareContext("ctx_rule_enable_success"); $grammar.declareContext("ctx_action_notification"); $grammar.declareContext("ctx_list_notification"); $grammar.declareContext("ctx_nonlist_notification"); $grammar.declareContext("ctx_notification_error"); $grammar.declareContext("ctx_sys_any"); $grammar.declareContext("ctx_sys_action_success"); $grammar.declareContext("ctx_sys_action_error"); $grammar.declareContext("ctx_sys_anything_else"); $grammar.declareContext("ctx_sys_confirm_action"); $grammar.declareContext("ctx_sys_display_result"); $grammar.declareContext("ctx_sys_empty_search"); $grammar.declareContext("ctx_sys_end"); $grammar.declareContext("ctx_sys_greet"); $grammar.declareContext("ctx_sys_learn_more_what"); $grammar.declareContext("ctx_sys_propose_refined_query"); $grammar.declareContext("ctx_sys_recommend_many"); $grammar.declareContext("ctx_sys_recommend_one"); $grammar.declareContext("ctx_sys_search_question"); $grammar.declareContext("ctx_sys_slot_fill"); $grammar.declareContext("ctx_current_query"); $grammar.declareContext("ctx_thingpedia_result"); $grammar.declareContext("ctx_thingpedia_empty_result"); $grammar.declareContext("ctx_thingpedia_list_result"); $grammar.declareContext("ctx_thingpedia_error_message"); $grammar.declareContext("ctx_result_name_list"); $grammar.declareContext("ctx_result_name"); $grammar.declareContext("ctx_notification_app_name"); $grammar.declareSymbol("initial_request_preamble"); $grammar.addRule("initial_request_preamble", [new $runtime.NonTerminal("ctx_init", "ctx", undefined), new $runtime.NonTerminal("base_table", "table", ["functionName" as ("functionName" extends keyof ReturnType ? string : void), 0, "nextFunction" as ("nextFunction" extends keyof ReturnType ? string : void)])], $locale._("{hello|hi}! i can help you {find a ${table[plural=one]}|{find|search for} ${table[plural=other]}}."), ((ctx : S.ContextInfo, table : Ast.InvocationExpression) : (S.ContextInfo)|null => ctx), S.contextKeyFn, { priority: (10) }); $grammar.addRule("initial_request_preamble", [new $runtime.NonTerminal("ctx_init", "ctx", undefined), new $runtime.NonTerminal("complete_action", "action", ["functionName" as ("functionName" extends keyof ReturnType ? string : void), 0, "nextFunction" as ("nextFunction" extends keyof ReturnType ? string : void)])], $locale._("{hello|hi}! i can help you ${action}."), ((ctx : S.ContextInfo, action : Ast.Expression) : (S.ContextInfo)|null => { const invocation = C.getInvocation(action); if (invocation.in_params.length > 0) return null; return ctx; }), S.contextKeyFn, { priority: (10) }); $grammar.declareSymbol("$agent"); $grammar.addRule("$agent", [new $runtime.NonTerminal("ctx_greet", "ctx", undefined)], $locale._("${ctx} {hello|hi} {!|,} {how can i help you|what are you interested in|what can i do for you} ?"), ((ctx : S.ContextInfo) : (S.AgentReplyRecord)|null => S.makeAgentReply(ctx, S.makeSimpleState(ctx, 'sys_greet', null), null, null)), undefined, { }); $grammar.addRule("$agent", [new $runtime.NonTerminal("ctx_init", "ctx", undefined)], $locale._("${ctx} {hello|hi} {!|,} {how can i help you|what are you interested in|what can i do for you} ?"), ((ctx : S.ContextInfo) : (S.AgentReplyRecord)|null => S.makeAgentReply(ctx, S.makeSimpleState(ctx, 'sys_greet', null), null, null)), undefined, { }); $grammar.addRule("$agent", [new $runtime.NonTerminal("ctx_reinit", "ctx", undefined)], $locale._("${ctx} {how can i help you|what are you interested in|what can i do for you} ?"), ((ctx : S.ContextInfo) : (S.AgentReplyRecord)|null => S.makeAgentReply(ctx, S.makeSimpleState(ctx, 'sys_greet', null), null, null)), undefined, { }); if ($options.flags.anything_else) { $grammar.addRule("$agent", [new $runtime.NonTerminal("ctx_cancel", "ctx", undefined), new $runtime.NonTerminal("anything_else_phrase", undefined, undefined)], $locale._("${ctx} ${anything_else_phrase}"), ((ctx : S.ContextInfo, $0 : string) : (S.AgentReplyRecord)|null => S.makeAgentReply(ctx, S.makeSimpleState(ctx, 'sys_anything_else', null), null, null, { end: false })), undefined, { }); $grammar.addRule("$agent", [new $runtime.NonTerminal("ctx_end", "ctx", undefined)], $locale._("${ctx} alright , {bye !|good bye !}"), ((ctx : S.ContextInfo) : (S.AgentReplyRecord)|null => S.makeAgentReply(ctx, S.makeSimpleState(ctx, 'sys_end', null))), undefined, { }); } if (!$options.flags.anything_else) { $grammar.addRule("$agent", [new $runtime.NonTerminal("ctx_cancel", "ctx", undefined)], $locale._("${ctx} alright, let me know if I can help you with anything else!"), ((ctx : S.ContextInfo) : (S.AgentReplyRecord)|null => S.makeAgentReply(ctx, S.makeSimpleState(ctx, 'sys_end', null))), undefined, { }); } $grammar.addRule("$agent", [new $runtime.NonTerminal("action_success_phrase", undefined, undefined)], "${action_success_phrase}", (($0 : S.AgentReplyRecord) : (S.AgentReplyRecord)|null => { return $0; }), undefined, { identity: (true) }); if ($options.flags.anything_else) { $grammar.addRule("$agent", [new $runtime.NonTerminal("action_success_phrase", "action", undefined), new $runtime.NonTerminal("anything_else_phrase", undefined, undefined)], $locale._("${action} ${anything_else_phrase}"), ((action : S.AgentReplyRecord, $0 : string) : (S.AgentReplyRecord)|null => S.setEndBit(action, false)), undefined, { }); } $grammar.addRule("$agent", [new $runtime.NonTerminal("ctx_completed_action_error", "ctx", undefined), new $runtime.NonTerminal("sorry_preamble", undefined, undefined), new $runtime.NonTerminal("action_error_phrase", "phrase", undefined)], $locale._("${ctx} ${sorry_preamble} ${phrase}"), ((ctx : S.ContextInfo, $0 : string, phrase : S.AgentReplyRecord) : (S.AgentReplyRecord)|null => phrase), undefined, { }); $grammar.addRule("$agent", [new $runtime.NonTerminal("ctx_display_nonlist_result", "ctx", undefined), new $runtime.NonTerminal("system_nonlist_result", "proposal", undefined)], $locale._("${ctx} ${proposal}"), ((ctx : S.ContextInfo, proposal : D.Recommendation) : (S.AgentReplyRecord)|null => D.makeDisplayResultReply(ctx, proposal)), undefined, { }); $grammar.addRule("$agent", [new $runtime.NonTerminal("ctx_display_nonlist_result", "ctx", undefined), new $runtime.NonTerminal("system_list_proposal", "proposal", undefined)], $locale._("${ctx} ${proposal}"), ((ctx : S.ContextInfo, proposal : D.ListProposal) : (S.AgentReplyRecord)|null => D.makeDisplayResultReplyFromList(ctx, proposal)), undefined, { }); $grammar.addRule("$agent", [new $runtime.NonTerminal("ctx_aggregation_question", "ctx", undefined), new $runtime.NonTerminal("count_aggregation_reply", "reply", undefined)], $locale._("${ctx} ${reply}"), ((ctx : S.ContextInfo, reply : S.AgentReplyRecord) : (S.AgentReplyRecord)|null => reply), undefined, { }); $grammar.addRule("$agent", [new $runtime.NonTerminal("ctx_aggregation_question", "ctx", undefined), new $runtime.NonTerminal("other_aggregation_reply", "reply", undefined)], $locale._("${ctx} ${reply}"), ((ctx : S.ContextInfo, reply : S.AgentReplyRecord) : (S.AgentReplyRecord)|null => reply), undefined, { }); $grammar.addRule("$agent", [new $runtime.NonTerminal("ctx_confirm_action", "ctx", undefined), new $runtime.NonTerminal("action_confirm_phrase", "reply", undefined)], $locale._("${ctx} ${reply}"), ((ctx : S.ContextInfo, reply : S.AgentReplyRecord) : (S.AgentReplyRecord)|null => reply), undefined, { }); $grammar.addRule("$agent", [new $runtime.NonTerminal("ctx_empty_search_command", "ctx", undefined), new $runtime.NonTerminal("empty_search_error", "error", undefined)], $locale._("${ctx} ${error}"), ((ctx : S.ContextInfo, error : [Ast.InvocationExpression|null, C.ParamSlot|null, boolean]) : (S.AgentReplyRecord)|null => D.makeEmptySearchError(ctx, error)), undefined, { }); if ($options.flags.multiwoz) { $grammar.addRule("$agent", [new $runtime.NonTerminal("system_generic_proposal", "prop", undefined)], "${prop}", ((prop : S.AgentReplyRecord) : (S.AgentReplyRecord)|null => prop), undefined, { }); } if (!$options.flags.inference) { $grammar.addRule("$agent", [new $runtime.NonTerminal("ctx_search_command", "ctx", undefined), new $runtime.NonTerminal("search_question", "questions", undefined)], $locale._("${ctx} ${questions}"), ((ctx : S.ContextInfo, questions : C.ParamSlot[]) : (S.AgentReplyRecord)|null => D.makeSearchQuestion(ctx, questions)), undefined, { }); } $grammar.addRule("$agent", [new $runtime.NonTerminal("ctx_incomplete_action_after_search", "ctx", undefined), new $runtime.NonTerminal("slot_fill_question", "questions", undefined)], $locale._("${ctx} ${questions}"), ((ctx : S.ContextInfo, questions : C.ParamSlot[]) : (S.AgentReplyRecord)|null => D.makeSlotFillQuestion(ctx, questions)), undefined, { }); $grammar.addRule("$agent", [new $runtime.NonTerminal("ctx_incomplete_action_after_search", "ctx", undefined), new $runtime.NonTerminal("initial_request_preamble", undefined, undefined), new $runtime.NonTerminal("slot_fill_question", "questions", undefined)], $locale._("${ctx} ${initial_request_preamble} ${questions}"), ((ctx : S.ContextInfo, $0 : S.ContextInfo, questions : C.ParamSlot[]) : (S.AgentReplyRecord)|null => D.makeSlotFillQuestion(ctx, questions)), undefined, { }); $grammar.addRule("$agent", [new $runtime.NonTerminal("ctx_complete_search_command", "ctx", undefined), new $runtime.NonTerminal("system_recommendation", "proposal", undefined)], $locale._("${ctx} ${proposal}"), ((ctx : S.ContextInfo, proposal : D.Recommendation) : (S.AgentReplyRecord)|null => D.makeRecommendationReply(ctx, proposal)), undefined, { }); $grammar.addRule("$agent", [new $runtime.NonTerminal("ctx_complete_search_command", "ctx", undefined), new $runtime.NonTerminal("system_list_proposal", "proposal", undefined)], $locale._("${ctx} ${proposal}"), ((ctx : S.ContextInfo, proposal : D.ListProposal) : (S.AgentReplyRecord)|null => D.makeListProposalReply(ctx, proposal)), undefined, { weight: (10) }); $grammar.addRule("$agent", [new $runtime.NonTerminal("ctx_with_missing_projection", "ctx", undefined)], $locale._("${ctx} sorry, I don't have that information at the moment"), ((ctx : S.ContextInfo) : (S.AgentReplyRecord)|null => S.makeAgentReply(ctx, S.makeSimpleState(ctx, 'sys_recommend_one', null))), undefined, { }); $grammar.addRule("$agent", [new $runtime.NonTerminal("ctx_learn_more", "ctx", undefined), new $runtime.NonTerminal("system_learn_more", undefined, undefined)], $locale._("${ctx} ${system_learn_more}"), ((ctx : S.ContextInfo, $0 : string) : (S.AgentReplyRecord)|null => S.makeAgentReply(ctx, S.makeSimpleState(ctx, 'sys_learn_more_what', null), null, null, { end: false })), undefined, { }); $grammar.addRule("$agent", [new $runtime.NonTerminal("ctx_rule_enable_success", "ctx", undefined), new $runtime.NonTerminal("generic_excitement2_phrase", "preamble", undefined), new $runtime.NonTerminal("ctx_current_statement", "stmt", undefined)], $locale._("${preamble} I {will|am going to} ${stmt}"), ((ctx : S.ContextInfo, preamble : string, stmt : S.ContextInfo) : (S.AgentReplyRecord)|null => S.makeAgentReply(ctx, S.makeSimpleState(ctx, 'sys_rule_enable_success', null))), undefined, { }); $grammar.addRule("$agent", [new $runtime.NonTerminal("ctx_list_notification", "ctx", undefined), new $runtime.NonTerminal("notification_preamble", undefined, undefined), new $runtime.NonTerminal("system_recommendation", "proposal", undefined)], $locale._("${ctx} ${notification_preamble} ${proposal}"), ((ctx : S.ContextInfo, $0 : S.ContextInfo, proposal : D.Recommendation) : (S.AgentReplyRecord)|null => D.makeRecommendationReply(ctx, proposal)), undefined, { }); $grammar.addRule("$agent", [new $runtime.NonTerminal("ctx_nonlist_notification", "ctx", undefined), new $runtime.NonTerminal("notification_preamble", undefined, undefined), new $runtime.NonTerminal("system_nonlist_result", "proposal", undefined)], $locale._("${ctx} ${notification_preamble} ${proposal}"), ((ctx : S.ContextInfo, $0 : S.ContextInfo, proposal : D.Recommendation) : (S.AgentReplyRecord)|null => D.makeDisplayResultReply(ctx, proposal)), undefined, { }); $grammar.addRule("$agent", [new $runtime.NonTerminal("action_notification_phrase", undefined, undefined)], "${action_notification_phrase}", (($0 : S.AgentReplyRecord) : (S.AgentReplyRecord)|null => { return $0; }), undefined, { identity: (true) }); $grammar.addRule("$agent", [new $runtime.NonTerminal("ctx_notification_error", "ctx", undefined), new $runtime.NonTerminal("notification_error_preamble", undefined, undefined), new $runtime.NonTerminal("action_error_phrase", "phrase", undefined)], $locale._("${ctx} ${notification_error_preamble} ${phrase}"), ((ctx : S.ContextInfo, $0 : S.ContextInfo, phrase : S.AgentReplyRecord) : (S.AgentReplyRecord)|null => phrase), undefined, { }); $grammar.declareSymbol("$user"); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_init", "ctx", undefined), new $runtime.NonTerminal("greeting", undefined, undefined)], $locale._("${ctx} ${greeting}"), ((ctx : S.ContextInfo, $0 : string) : (Ast.DialogueState)|null => S.makeSimpleState(ctx, 'greet', null)), undefined, { weight: (0.01), expandchoice: (false) }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_init", "ctx", undefined), new $runtime.NonTerminal("initial_command", "stmt", undefined)], $locale._("${ctx} ${stmt}"), ((ctx : S.ContextInfo, stmt : Ast.Expression) : (Ast.DialogueState)|null => D.startNewRequest($loader, ctx, stmt)), undefined, { weight: (0.5) }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_init", "ctx", undefined), new $runtime.NonTerminal("greeting", undefined, undefined), new $runtime.NonTerminal("initial_command", "stmt", undefined)], $locale._("${ctx} ${greeting} ${stmt}"), ((ctx : S.ContextInfo, $0 : string, stmt : Ast.Expression) : (Ast.DialogueState)|null => D.startNewRequest($loader, ctx, stmt)), undefined, { weight: (0.5) }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_greet", "ctx", undefined), new $runtime.NonTerminal("initial_command", "stmt", undefined)], $locale._("${ctx} ${stmt}"), ((ctx : S.ContextInfo, stmt : Ast.Expression) : (Ast.DialogueState)|null => D.startNewRequest($loader, ctx, stmt)), undefined, { }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_anything_else", "ctx", undefined), new $runtime.NonTerminal("no_thanks_phrase", undefined, undefined)], $locale._("${ctx} ${no_thanks_phrase} {goodbye !|}"), ((ctx : S.ContextInfo, $0 : string) : (Ast.DialogueState)|null => S.makeSimpleState(ctx, 'end', null)), undefined, { weight: (0.01) }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_anything_else", "ctx", undefined), new $runtime.NonTerminal("thanks_phrase", undefined, undefined)], $locale._("${ctx} ${thanks_phrase} {goodbye !|}"), ((ctx : S.ContextInfo, $0 : string) : (Ast.DialogueState)|null => S.makeSimpleState(ctx, 'end', null)), undefined, { weight: (0.01) }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_anything_else", "ctx", undefined), new $runtime.NonTerminal("initial_command", "stmt", undefined)], $locale._("${ctx} ${stmt}"), ((ctx : S.ContextInfo, stmt : Ast.Expression) : (Ast.DialogueState)|null => D.startNewRequest($loader, ctx, stmt)), undefined, { }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_anything_else", "ctx", undefined), new $runtime.NonTerminal("yes_please_phrase", undefined, undefined), new $runtime.NonTerminal("initial_command", "stmt", undefined)], $locale._("${ctx} ${yes_please_phrase} ${stmt}"), ((ctx : S.ContextInfo, $0 : string, stmt : Ast.Expression) : (Ast.DialogueState)|null => D.startNewRequest($loader, ctx, stmt)), undefined, { }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_anything_else", "ctx", undefined), new $runtime.NonTerminal("yes_please_phrase", undefined, undefined)], $locale._("${ctx} ${yes_please_phrase}"), ((ctx : S.ContextInfo, $0 : string) : (Ast.DialogueState)|null => S.makeSimpleState(ctx, 'reinit', null)), undefined, { }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_confirm_action", "ctx", undefined), new $runtime.NonTerminal("accept_phrase", undefined, undefined)], $locale._("${ctx} ${accept_phrase}"), ((ctx : S.ContextInfo, $0 : string) : (Ast.DialogueState)|null => D.actionConfirmAcceptPhrase(ctx)), undefined, { weight: (0.9) }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_confirm_action", "ctx", undefined), new $runtime.NonTerminal("reject_phrase", undefined, undefined)], $locale._("${ctx} ${reject_phrase}"), ((ctx : S.ContextInfo, $0 : string) : (Ast.DialogueState)|null => D.actionConfirmRejectPhrase(ctx)), undefined, { weight: (0.1) }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_confirm_action", "ctx", undefined), new $runtime.NonTerminal("reject_phrase", undefined, undefined), new $runtime.NonTerminal("imprecise_slot_fill_answer_phrase", "answer", undefined)], $locale._("${ctx} ${reject_phrase} {can you try|how about} ${answer} {instead ?|}"), ((ctx : S.ContextInfo, $0 : string, answer : Ast.Value|C.InputParamSlot) : (Ast.DialogueState)|null => D.actionConfirmChangeParam(ctx, answer)), undefined, { weight: (0.1) }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_action_success", "ctx", undefined), new $runtime.NonTerminal("thanks_phrase", undefined, undefined)], $locale._("${ctx} ${thanks_phrase} {goodbye !|}"), ((ctx : S.ContextInfo, $0 : string) : (Ast.DialogueState)|null => S.makeSimpleState(ctx, 'cancel', null)), undefined, { }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_display_result", "ctx", undefined), new $runtime.NonTerminal("thanks_phrase", undefined, undefined)], $locale._("${ctx} ${thanks_phrase} {goodbye !|}"), ((ctx : S.ContextInfo, $0 : string) : (Ast.DialogueState)|null => S.makeSimpleState(ctx, 'cancel', null)), undefined, { }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_action_success", "ctx", undefined), new $runtime.NonTerminal("simple_user_search_question", "questions", undefined)], $locale._("${ctx} ${questions}"), ((ctx : S.ContextInfo, questions : C.ParamSlot[]) : (Ast.DialogueState)|null => D.actionSuccessQuestion(ctx, questions)), undefined, { }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_display_result", "ctx", undefined), new $runtime.NonTerminal("repeat_command_phrase", undefined, undefined)], $locale._("${ctx} ${repeat_command_phrase}"), ((ctx : S.ContextInfo, $0 : string) : (Ast.DialogueState)|null => D.repeatCommandReply(ctx)), undefined, { }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_action_error", "ctx", undefined), new $runtime.NonTerminal("repeat_command_on_error_phrase", undefined, undefined)], $locale._("${ctx} ${repeat_command_on_error_phrase}"), ((ctx : S.ContextInfo, $0 : string) : (Ast.DialogueState)|null => D.repeatCommandReply(ctx)), undefined, { }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_action_success", "ctx", undefined), new $runtime.NonTerminal("initial_command", "stmt", undefined)], $locale._("${ctx} ${stmt}"), ((ctx : S.ContextInfo, stmt : Ast.Expression) : (Ast.DialogueState)|null => D.startNewRequest($loader, ctx, stmt)), undefined, { }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_action_success", "ctx", undefined), new $runtime.NonTerminal("yes_please_phrase", undefined, undefined), new $runtime.NonTerminal("initial_command", "stmt", undefined)], $locale._("${ctx} ${yes_please_phrase} ${stmt}"), ((ctx : S.ContextInfo, $0 : string, stmt : Ast.Expression) : (Ast.DialogueState)|null => D.startNewRequest($loader, ctx, stmt)), undefined, { }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_display_result", "ctx", undefined), new $runtime.NonTerminal("initial_command", "stmt", undefined)], $locale._("${ctx} ${stmt}"), ((ctx : S.ContextInfo, stmt : Ast.Expression) : (Ast.DialogueState)|null => D.startNewRequest($loader, ctx, stmt)), undefined, { }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_display_result", "ctx", undefined), new $runtime.NonTerminal("yes_please_phrase", undefined, undefined), new $runtime.NonTerminal("initial_command", "stmt", undefined)], $locale._("${ctx} ${yes_please_phrase} ${stmt}"), ((ctx : S.ContextInfo, $0 : string, stmt : Ast.Expression) : (Ast.DialogueState)|null => D.startNewRequest($loader, ctx, stmt)), undefined, { }); if (!$options.flags.multiwoz) { $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_recommend_one", "ctx", undefined), new $runtime.NonTerminal("initial_command", "stmt", undefined)], $locale._("${ctx} ${stmt}"), ((ctx : S.ContextInfo, stmt : Ast.Expression) : (Ast.DialogueState)|null => D.startNewRequest($loader, ctx, stmt)), undefined, { }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_action_error", "ctx", undefined), new $runtime.NonTerminal("initial_command", "stmt", undefined)], $locale._("${ctx} ${stmt}"), ((ctx : S.ContextInfo, stmt : Ast.Expression) : (Ast.DialogueState)|null => D.startNewRequest($loader, ctx, stmt)), undefined, { }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_recommend_many", "ctx", undefined), new $runtime.NonTerminal("initial_command", "stmt", undefined)], $locale._("${ctx} ${stmt}"), ((ctx : S.ContextInfo, stmt : Ast.Expression) : (Ast.DialogueState)|null => D.startNewRequest($loader, ctx, stmt)), undefined, { }); } $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_action_error", "ctx", undefined), new $runtime.NonTerminal("no_thanks_phrase", undefined, undefined)], $locale._("${ctx} ${no_thanks_phrase}"), ((ctx : S.ContextInfo, $0 : string) : (Ast.DialogueState)|null => S.makeSimpleState(ctx, 'cancel', null)), undefined, { }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_action_error", "ctx", undefined), new $runtime.NonTerminal("nevermind_phrase", undefined, undefined)], $locale._("${ctx} ${nevermind_phrase}"), ((ctx : S.ContextInfo, $0 : string) : (Ast.DialogueState)|null => S.makeSimpleState(ctx, 'cancel', null)), undefined, { }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_empty_search", "ctx", undefined), new $runtime.NonTerminal("precise_empty_search_change_request", "req", ["functionName" as ("functionName" extends keyof ReturnType ? string : void), 0, "currentTableFunction" as ("currentTableFunction" extends keyof ReturnType ? string : void)])], $locale._("${ctx} ${req}"), ((ctx : S.ContextInfo, req : Ast.Expression) : (Ast.DialogueState)|null => D.preciseEmptySearchChangeRequest(ctx, req)), undefined, { }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_empty_search", "ctx", undefined), new $runtime.NonTerminal("imprecise_empty_search_change_request", "req", undefined)], $locale._("${ctx} ${req}"), ((ctx : S.ContextInfo, req : Ast.Value|C.FilterSlot) : (Ast.DialogueState)|null => D.impreciseEmptySearchChangeRequest(ctx, req)), undefined, { }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_empty_search", "ctx", undefined), new $runtime.NonTerminal("accept_phrase", undefined, undefined)], $locale._("${ctx} ${accept_phrase}"), ((ctx : S.ContextInfo, $0 : string) : (Ast.DialogueState)|null => D.acceptEmptySearchOffer(ctx)), undefined, { }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_search_question", "ctx", undefined), new $runtime.NonTerminal("precise_search_question_answer", "answer", ["functionName" as ("functionName" extends keyof ReturnType ? string : void), 0, "currentFunction" as ("currentFunction" extends keyof ReturnType ? string : void)])], $locale._("${ctx} ${answer}"), ((ctx : S.ContextInfo, answer : D.PreciseSearchQuestionAnswer) : (Ast.DialogueState)|null => D.preciseSearchQuestionAnswer(ctx, answer)), undefined, { }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_search_question", "ctx", undefined), new $runtime.NonTerminal("imprecise_search_question_answer", "answer", undefined)], $locale._("${ctx} ${answer}"), ((ctx : S.ContextInfo, answer : Ast.Value|C.FilterSlot|'dontcare') : (Ast.DialogueState)|null => D.impreciseSearchQuestionAnswer(ctx, answer)), undefined, { weight: (0.2) }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_slot_fill", "ctx", undefined), new $runtime.NonTerminal("precise_slot_fill_answer", "answer", ["functionName" as ("functionName" extends keyof ReturnType ? string : void), 0, "nextFunction" as ("nextFunction" extends keyof ReturnType ? string : void)])], $locale._("${ctx} ${answer}"), ((ctx : S.ContextInfo, answer : Ast.Invocation) : (Ast.DialogueState)|null => D.preciseSlotFillAnswer(ctx, answer)), undefined, { }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_slot_fill", "ctx", undefined), new $runtime.NonTerminal("imprecise_slot_fill_answer", "answer", undefined)], $locale._("${ctx} ${answer}"), ((ctx : S.ContextInfo, answer : Ast.Value|C.InputParamSlot) : (Ast.DialogueState)|null => D.impreciseSlotFillAnswer(ctx, answer)), undefined, { }); if ($options.flags.multiwoz) { $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_recommend_many", "ctx", undefined), new $runtime.NonTerminal("ask_recommend_phrase", undefined, undefined)], $locale._("${ctx} ${ask_recommend_phrase}"), ((ctx : S.ContextInfo, $0 : string) : (Ast.DialogueState)|null => S.makeSimpleState(ctx, 'ask_recommend', null)), undefined, { }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_search_question", "ctx", undefined), new $runtime.NonTerminal("ask_recommend_phrase", undefined, undefined)], $locale._("${ctx} ${ask_recommend_phrase}"), ((ctx : S.ContextInfo, $0 : string) : (Ast.DialogueState)|null => S.makeSimpleState(ctx, 'ask_recommend', null)), undefined, { }); } $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_propose_refined_query", "ctx", undefined), new $runtime.NonTerminal("accept_phrase", undefined, undefined)], $locale._("${ctx} ${accept_phrase}"), ((ctx : S.ContextInfo, $0 : string) : (Ast.DialogueState)|null => D.positiveProposalReply(ctx)), undefined, { weight: (0.5) }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_propose_refined_query", "ctx", undefined), new $runtime.NonTerminal("negative_proposal_reply", "reply", ["functionName" as ("functionName" extends keyof ReturnType ? string : void), 0, "currentFunction" as ("currentFunction" extends keyof ReturnType ? string : void)])], $locale._("${ctx} ${reply}"), ((ctx : S.ContextInfo, reply : D.NegativeProposalReply) : (Ast.DialogueState)|null => D.negativeProposalReply(ctx, reply)), undefined, { weight: (0.5) }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_recommend_one", "ctx", undefined), new $runtime.NonTerminal("accept_phrase", undefined, undefined)], $locale._("${ctx} ${accept_phrase}"), ((ctx : S.ContextInfo, $0 : string) : (Ast.DialogueState)|null => D.positiveRecommendationReply($loader, ctx, null, null)), undefined, { weight: (0.7) }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_recommend_one", "ctx", undefined), new $runtime.NonTerminal("recommendation_accept_phrase_with_action", "acceptedAction", undefined)], $locale._("${ctx} ${acceptedAction}"), ((ctx : S.ContextInfo, acceptedAction : Ast.Invocation) : (Ast.DialogueState)|null => D.positiveRecommendationReply($loader, ctx, acceptedAction, null)), undefined, { weight: (0.7) }); if ($options.flags.multiwoz) { $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_recommend_one", "ctx", undefined), new $runtime.NonTerminal("recommendation_accept_phrase_by_name", "name", undefined)], $locale._("${ctx} ${name}"), ((ctx : S.ContextInfo, name : [Ast.EntityValue|Ast.NumberValue, Ast.Invocation|null]) : (Ast.DialogueState)|null => D.positiveRecommendationReply($loader, ctx, name[1], name[0])), undefined, { weight: (0.7) }); } $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_recommend_one", "ctx", undefined), new $runtime.NonTerminal("tell_me_more_phrase", undefined, undefined)], $locale._("${ctx} ${tell_me_more_phrase}"), ((ctx : S.ContextInfo, $0 : string) : (Ast.DialogueState)|null => D.recommendationLearnMoreReply(ctx, null)), undefined, { weight: (0.5) }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_recommend_one", "ctx", undefined), new $runtime.NonTerminal("accept_phrase", undefined, undefined), new $runtime.NonTerminal("tell_me_more_phrase", undefined, undefined)], $locale._("${ctx} ${accept_phrase} ${tell_me_more_phrase}"), ((ctx : S.ContextInfo, $0 : string, $1 : string) : (Ast.DialogueState)|null => D.recommendationLearnMoreReply(ctx, null)), undefined, { weight: (0.5) }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_recommend_one", "ctx", undefined), new $runtime.NonTerminal("list_proposal_tell_me_more", "name", undefined)], $locale._("${ctx} ${name}"), ((ctx : S.ContextInfo, name : Ast.EntityValue|Ast.NumberValue) : (Ast.DialogueState)|null => D.recommendationLearnMoreReply(ctx, name)), undefined, { }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_recommend_one", "ctx", undefined), new $runtime.NonTerminal("negative_proposal_reply", "reply", ["functionName" as ("functionName" extends keyof ReturnType ? string : void), 0, "currentFunction" as ("currentFunction" extends keyof ReturnType ? string : void)])], $locale._("${ctx} ${reply}"), ((ctx : S.ContextInfo, reply : D.NegativeProposalReply) : (Ast.DialogueState)|null => D.negativeRecommendationReply(ctx, reply)), undefined, { weight: (0.6) }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_recommend_one", "ctx", undefined), new $runtime.NonTerminal("thanks_phrase", undefined, undefined)], $locale._("${ctx} ${thanks_phrase} {goodbye !|}"), ((ctx : S.ContextInfo, $0 : string) : (Ast.DialogueState)|null => D.recommendationCancelReply(ctx, true)), undefined, { }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_recommend_one", "ctx", undefined), new $runtime.NonTerminal("ok_thanks_phrase", undefined, undefined)], $locale._("${ctx} ${ok_thanks_phrase} {goodbye !|}"), ((ctx : S.ContextInfo, $0 : string) : (Ast.DialogueState)|null => D.recommendationCancelReply(ctx, !ctx.aux.action && !ctx.aux.hasLearnMore)), undefined, { }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_recommend_one", "ctx", undefined), new $runtime.NonTerminal("no_thanks_phrase", undefined, undefined)], $locale._("${ctx} ${no_thanks_phrase} {goodbye !|}"), ((ctx : S.ContextInfo, $0 : string) : (Ast.DialogueState)|null => D.recommendationCancelReply(ctx, ctx.aux.action || ctx.aux.hasLearnMore)), undefined, { }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_recommend_one", "ctx", undefined), new $runtime.NonTerminal("related_question", "question", undefined)], $locale._("${ctx} ${question}"), ((ctx : S.ContextInfo, question : Ast.DialogueState) : (Ast.DialogueState)|null => question), undefined, { }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_recommend_one", "ctx", undefined), new $runtime.NonTerminal("user_search_question", "questions", ["functionName" as ("functionName" extends keyof ReturnType ? string : void), 0, "currentFunction" as ("currentFunction" extends keyof ReturnType ? string : void)])], $locale._("${ctx} ${questions}"), ((ctx : S.ContextInfo, questions : C.ParamSlot[]) : (Ast.DialogueState)|null => D.recommendationSearchQuestionReply(ctx, questions)), undefined, { }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_learn_more_what", "ctx", undefined), new $runtime.NonTerminal("user_search_question", "questions", ["functionName" as ("functionName" extends keyof ReturnType ? string : void), 0, "currentFunction" as ("currentFunction" extends keyof ReturnType ? string : void)])], $locale._("${ctx} ${questions}"), ((ctx : S.ContextInfo, questions : C.ParamSlot[]) : (Ast.DialogueState)|null => D.learnMoreSearchQuestionReply(ctx, questions)), undefined, { }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_display_result", "ctx", undefined), new $runtime.NonTerminal("user_search_question", "questions", ["functionName" as ("functionName" extends keyof ReturnType ? string : void), 0, "currentFunction" as ("currentFunction" extends keyof ReturnType ? string : void)])], $locale._("${ctx} ${questions}"), ((ctx : S.ContextInfo, questions : C.ParamSlot[]) : (Ast.DialogueState)|null => D.displayResultSearchQuestionReply(ctx, questions)), undefined, { }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_recommend_many", "ctx", undefined), new $runtime.NonTerminal("positive_list_proposal_reply", "reply", undefined)], $locale._("${ctx} ${reply}"), ((ctx : S.ContextInfo, reply : [Ast.EntityValue|Ast.NumberValue, Ast.Invocation|null, boolean]) : (Ast.DialogueState)|null => D.positiveListProposalReply($loader, ctx, reply)), undefined, { weight: (10 * 0.7) }); if ($options.flags.multiwoz) { $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_recommend_many", "ctx", undefined), new $runtime.NonTerminal("list_proposal_accept_phrase_with_action_by_name", "action", undefined)], $locale._("${ctx} ${action}"), ((ctx : S.ContextInfo, action : Ast.Invocation) : (Ast.DialogueState)|null => D.positiveListProposalReplyActionByName($loader, ctx, action)), undefined, { weight: (10 * 0.7) }); } $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_recommend_many", "ctx", undefined), new $runtime.NonTerminal("list_proposal_tell_me_more", "name", undefined)], $locale._("${ctx} ${name}"), ((ctx : S.ContextInfo, name : Ast.EntityValue|Ast.NumberValue) : (Ast.DialogueState)|null => D.listProposalLearnMoreReply(ctx, name)), undefined, { }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_recommend_many", "ctx", undefined), new $runtime.NonTerminal("negative_proposal_reply", "reply", ["functionName" as ("functionName" extends keyof ReturnType ? string : void), 0, "currentFunction" as ("currentFunction" extends keyof ReturnType ? string : void)])], $locale._("${ctx} ${reply}"), ((ctx : S.ContextInfo, reply : D.NegativeProposalReply) : (Ast.DialogueState)|null => D.negativeListProposalReply(ctx, reply)), undefined, { weight: (0.6) }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_recommend_many", "ctx", undefined), new $runtime.NonTerminal("related_question", "question", undefined)], $locale._("${ctx} ${question}"), ((ctx : S.ContextInfo, question : Ast.DialogueState) : (Ast.DialogueState)|null => question), undefined, { }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_recommend_many", "ctx", undefined), new $runtime.NonTerminal("user_search_question_for_list", "questions", ["functionName" as ("functionName" extends keyof ReturnType ? string : void), 0, "currentFunction" as ("currentFunction" extends keyof ReturnType ? string : void)])], $locale._("${ctx} ${questions}"), ((ctx : S.ContextInfo, questions : D.UserSearchQuestionForList) : (Ast.DialogueState)|null => D.listProposalSearchQuestionReply(ctx, questions)), undefined, { }); if (!$options.flags.nostream) { $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_action_success", "ctx", undefined), new $runtime.NonTerminal("add_separate_stream", "stream", undefined)], $locale._("${ctx} ${stream}"), ((ctx : S.ContextInfo, stream : Ast.Expression) : (Ast.DialogueState)|null => D.addStream(ctx, stream)), undefined, { }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_recommend_one", "ctx", undefined), new $runtime.NonTerminal("add_separate_stream_to_query", "stream", undefined)], $locale._("${ctx} ${stream}"), ((ctx : S.ContextInfo, stream : Ast.Expression) : (Ast.DialogueState)|null => D.addStream(ctx, stream)), undefined, { }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_recommend_many", "ctx", undefined), new $runtime.NonTerminal("add_separate_stream_to_query", "stream", undefined)], $locale._("${ctx} ${stream}"), ((ctx : S.ContextInfo, stream : Ast.Expression) : (Ast.DialogueState)|null => D.addStream(ctx, stream)), undefined, { }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_display_result", "ctx", undefined), new $runtime.NonTerminal("add_separate_stream_to_query", "stream", undefined)], $locale._("${ctx} ${stream}"), ((ctx : S.ContextInfo, stream : Ast.Expression) : (Ast.DialogueState)|null => D.addStream(ctx, stream)), undefined, { }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_recommend_one", "ctx", ["is_monitorable" as ("is_monitorable" extends keyof ReturnType ? string : void), (true) as ReturnType["is_monitorable"]]), new $runtime.NonTerminal("make_monitor_phrase", undefined, undefined)], $locale._("${ctx} ${make_monitor_phrase}"), ((ctx : S.ContextInfo, $0 : string) : (Ast.DialogueState)|null => D.makeMonitor(ctx, { monitorItemID : false })), undefined, { }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_recommend_many", "ctx", ["is_monitorable" as ("is_monitorable" extends keyof ReturnType ? string : void), (true) as ReturnType["is_monitorable"]]), new $runtime.NonTerminal("make_monitor_phrase", undefined, undefined)], $locale._("${ctx} ${make_monitor_phrase}"), ((ctx : S.ContextInfo, $0 : string) : (Ast.DialogueState)|null => D.makeMonitor(ctx, { monitorItemID : false })), undefined, { }); $grammar.addRule("$user", [new $runtime.NonTerminal("ctx_sys_display_result", "ctx", ["is_monitorable" as ("is_monitorable" extends keyof ReturnType ? string : void), (true) as ReturnType["is_monitorable"]]), new $runtime.NonTerminal("make_monitor_phrase", undefined, undefined)], $locale._("${ctx} ${make_monitor_phrase}"), ((ctx : S.ContextInfo, $0 : string) : (Ast.DialogueState)|null => D.makeMonitor(ctx, { monitorItemID : false })), undefined, { }); } };