"use strict";
// -*- 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 <gcampagn@cs.stanford.edu>
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const C = __importStar(require("../../ast_manip"));
async function default_1($runtime, $ttUtils, $options, $locale, $grammar, $loader) {
    $grammar.declareSymbol("one_param_slot_fill_question");
    $grammar.addRule("one_param_slot_fill_question", [new $runtime.NonTerminal("thingpedia_slot_fill_question", undefined), "?"], ((p, $0) => [p]), C.paramArrayKeyFn, { priority: (0.1) });
    $grammar.addRule("one_param_slot_fill_question", ["what", new $runtime.NonTerminal("input_param", undefined), new $runtime.NonTerminal("prefer_question_phrase", undefined), "?"], (($0, p, $1, $2) => [p]), C.paramArrayKeyFn, {});
    $grammar.declareSymbol("two_param_slot_fill_question");
    $grammar.addRule("two_param_slot_fill_question", ["what", new $runtime.NonTerminal("input_param", undefined), "and", new $runtime.NonTerminal("input_param", ["functionName", 1, "functionName"]), new $runtime.NonTerminal("prefer_question_phrase", undefined), "?"], (($0, p1, $1, p2, $2, $3) => {
        if (p1.name === p2.name || !C.isSameFunction(p1.schema, p2.schema))
            return null;
        return [p1, p2];
    }), C.paramArrayKeyFn, {});
    $grammar.addRule("two_param_slot_fill_question", [new $runtime.NonTerminal("thingpedia_slot_fill_question", undefined), "and", "what", new $runtime.NonTerminal("input_param", ["functionName", 0, "functionName"]), new $runtime.NonTerminal("prefer_question_phrase", undefined), "?"], ((p1, $0, $1, p2, $2, $3) => {
        if (p1.name === p2.name || !C.isSameFunction(p1.schema, p2.schema))
            return null;
        return [p1, p2];
    }), C.paramArrayKeyFn, {});
    $grammar.addRule("two_param_slot_fill_question", ["what", new $runtime.NonTerminal("input_param", undefined), new $runtime.NonTerminal("prefer_question_phrase", undefined), "and", new $runtime.NonTerminal("thingpedia_slot_fill_question", ["functionName", 1, "functionName"]), "?"], (($0, p1, $1, $2, p2, $3) => {
        if (p1.name === p2.name || !C.isSameFunction(p1.schema, p2.schema))
            return null;
        return [p1, p2];
    }), C.paramArrayKeyFn, {});
    $grammar.declareSymbol("slot_fill_question");
    $grammar.addRule("slot_fill_question", [new $runtime.NonTerminal("one_param_slot_fill_question", undefined)], (($0) => { return $0; }), C.paramArrayKeyFn, { priority: (0.1), identity: (true) });
    if (!$options.flags.inference) {
        $grammar.addRule("slot_fill_question", [new $runtime.NonTerminal("two_param_slot_fill_question", undefined)], (($0) => { return $0; }), C.paramArrayKeyFn, { identity: (true) });
    }
    $grammar.declareSymbol("imprecise_slot_fill_answer_phrase");
    $grammar.addRule("imprecise_slot_fill_answer_phrase", [new $runtime.NonTerminal("constant_Any", undefined)], ((slot) => slot), undefined, {});
    $grammar.addRule("imprecise_slot_fill_answer_phrase", [new $runtime.NonTerminal("npp_input_param", undefined)], ((slot) => slot), undefined, {});
    $grammar.addRule("imprecise_slot_fill_answer_phrase", [new $runtime.NonTerminal("apv_input_param", undefined)], ((slot) => slot), undefined, {});
    $grammar.addRule("imprecise_slot_fill_answer_phrase", [new $runtime.NonTerminal("pvp_input_param", undefined)], ((slot) => slot), undefined, {});
    $grammar.addRule("imprecise_slot_fill_answer_phrase", [new $runtime.NonTerminal("preposition_input_param", undefined)], ((slot) => slot), undefined, {});
    $grammar.declareSymbol("imprecise_slot_fill_coref_answer");
    $grammar.addRule("imprecise_slot_fill_coref_answer", [new $runtime.NonTerminal("coref_constant", undefined)], ((slot) => slot), undefined, {});
    $grammar.addRule("imprecise_slot_fill_coref_answer", [new $runtime.NonTerminal("coref_npp_input_param", undefined)], ((slot) => slot), undefined, {});
    $grammar.addRule("imprecise_slot_fill_coref_answer", [new $runtime.NonTerminal("coref_apv_input_param", undefined)], ((slot) => slot), undefined, {});
    $grammar.addRule("imprecise_slot_fill_coref_answer", [new $runtime.NonTerminal("coref_pvp_input_param", undefined)], ((slot) => slot), undefined, {});
    $grammar.addRule("imprecise_slot_fill_coref_answer", [new $runtime.NonTerminal("coref_preposition_input_param", undefined)], ((slot) => slot), undefined, {});
    $grammar.declareSymbol("imprecise_slot_fill_answer");
    $grammar.addRule("imprecise_slot_fill_answer", [new $runtime.NonTerminal("imprecise_slot_fill_answer_phrase", undefined), new $runtime.Choice(["please", ""]), "."], ((ans, $0, $1) => ans), undefined, {});
    $grammar.addRule("imprecise_slot_fill_answer", [new $runtime.NonTerminal("generic_preamble_for_answer", undefined), new $runtime.NonTerminal("imprecise_slot_fill_answer_phrase", undefined), "."], (($0, ans, $1) => ans), undefined, {});
    $grammar.addRule("imprecise_slot_fill_answer", [new $runtime.NonTerminal("imprecise_slot_fill_coref_answer", undefined), new $runtime.Choice(["please", ""]), "."], ((ans, $0, $1) => ans), undefined, {});
    $grammar.addRule("imprecise_slot_fill_answer", [new $runtime.NonTerminal("generic_preamble_for_answer", undefined), new $runtime.NonTerminal("imprecise_slot_fill_coref_answer", undefined), "."], (($0, ans, $1) => ans), undefined, {});
    $grammar.declareSymbol("precise_slot_fill_answer");
    $grammar.addRule("precise_slot_fill_answer", [new $runtime.NonTerminal("generic_preamble_for_action", undefined), new $runtime.NonTerminal("action_continuation_command", undefined)], (($0, action) => action), C.invocationKeyFn, {});
    $grammar.addRule("precise_slot_fill_answer", [new $runtime.NonTerminal("generic_preamble_for_answer", undefined), new $runtime.NonTerminal("generic_article", undefined), new $runtime.NonTerminal("continuation_query", undefined)], (($0, $1, query) => query), C.invocationKeyFn, {});
    $grammar.addRule("precise_slot_fill_answer", [new $runtime.NonTerminal("generic_verb_for_search", undefined), new $runtime.NonTerminal("generic_article", undefined), new $runtime.NonTerminal("continuation_query", undefined)], (($0, $1, query) => query), C.invocationKeyFn, {});
}
exports.default = default_1;
;
//# sourceMappingURL=slot-fill.genie.js.map