//============================================================================= // // Copyright (c) 2000-2007, Carnegie Mellon University. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // 1. Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // 2. Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in // the documentation and/or other materials provided with the // distribution. // // This work was supported in part by funding from the Defense Advanced // Research Projects Agency and the National Science Foundation of the // United States of America, and the CMU Sphinx Speech Consortium. // // THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND // ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY // NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // //============================================================================= // DialogTask: v1 // by Katherine Lang (lang@cs.rochester.edu), 2010 // Based on OLYMPUS TUTORIAL 1; by Antoine Raux (antoine@cs.cmu.edu), 2007 //----------------------------------------------------------------------------- // // DIALOGTASK.CPP (v1)- This module contains the description of the dialog // task, (i.e. all the user defined agencies, etc, etc) // for the first version of the NLDS for MIFIRA // note: change from v0 - results now summarized for user //----------------------------------------------------------------------------- #include "DialogTask.h" #define __IN_DIALOGTASK__ //----------------------------------------------------------------------------- // // DM GALAXY SERVER CONFIGURATION // //----------------------------------------------------------------------------- #ifdef GALAXY DMSERVER_CONFIGURATION("DialogManager", 17000) #endif //----------------------------------------------------------------------------- // // CONSTANT DEFINITIONS // //----------------------------------------------------------------------------- /*// query types ID number (goes into the "QueryType" concept) #define NQ_NEW_REQUEST 1 #define NQ_NEXT_BUS 2 #define NQ_PREVIOUS_BUS 3 */ // return codes from the backend #define RC_OKAY 0 #define RC_INTERNAL_ERROR 1 //#define RC_NO_BUS_AFTER_THAT 2 //#define RC_NO_BUS_BEFORE_THAT 3 //----------------------------------------------------------------------------- // // DIALOG CORE CONFIGURATION // //----------------------------------------------------------------------------- CORE_CONFIGURATION( // declare the NLG and the GUI as output devices USE_OUTPUT_DEVICES( DEFAULT_OUTPUT_DEVICE("nlg", "nlg.launch_query", 1) ) ) //----------------------------------------------------------------------------- // // CONCEPT TYPES DEFINITION // //----------------------------------------------------------------------------- // Result frame giving bus schedules DEFINE_FRAME_CONCEPT_TYPE( CResultConcept, ITEMS( //INT_ITEM(failed) STRING_ITEM(num_total_ppl) STRING_ITEM(num_total_men) STRING_ITEM(num_total_women) ) ) //----------------------------------------------------------------------------- // // AGENT SPECIFICATIONS // //----------------------------------------------------------------------------- // /DialogTask DEFINE_AGENCY( CDialogTask, IS_MAIN_TOPIC() DEFINE_CONCEPTS( STRING_USER_CONCEPT(num_total_ppl, "default") STRING_USER_CONCEPT(num_total_men, "default") STRING_USER_CONCEPT(num_total_women, "default") CUSTOM_USER_CONCEPT(result, CResultConcept) ) DEFINE_SUBAGENTS( SUBAGENT(GiveIntroduction, CGiveIntroduction, "") SUBAGENT(GetTotalPpl, CGetTotalPpl, "") SUBAGENT(GetTotalMen, CGetTotalMen, "") SUBAGENT(GetTotalWomen, CGetTotalWomen, "") SUBAGENT(ProcessResults, CProcessResults, "") SUBAGENT(GiveResults, CGiveResults, "") SUBAGENT(Goodbye, CGoodbye, "") ) ) // /DialogTask/GiveIntroduction DEFINE_INFORM_AGENT( CGiveIntroduction, PROMPT( ":non-interruptible inform welcome") ) // /DialogTask/GetTotalPpl DEFINE_REQUEST_AGENT( CGetTotalPpl, PROMPT("request num_total_ppl") REQUEST_CONCEPT(num_total_ppl) GRAMMAR_MAPPING("![NumTotalPeople.number]") ) // /DialogTask/GetTotalMen DEFINE_REQUEST_AGENT( CGetTotalMen, PROMPT("request num_total_men") REQUEST_CONCEPT(num_total_men) GRAMMAR_MAPPING("![NumTotalMen]") ) // /DialogTask/GetTotalWomen DEFINE_REQUEST_AGENT( CGetTotalWomen, PROMPT("request num_total_women") REQUEST_CONCEPT(num_total_women) GRAMMAR_MAPPING("![NumTotalWomen]") ) // /DialogTask/ProcessResults DEFINE_EXECUTE_AGENT( CProcessResults, EXECUTE( pTrafficManager->Call(this, "gal_be.launch_query result"); //C("result")= C("result") ) ) // /DialogTask/GiveResults DEFINE_INFORM_AGENT( CGiveResults, //PRECONDITION(AVAILABLE(result)) PROMPT("inform result") ) // /DialogTask/GreetGoodbye DEFINE_INFORM_AGENT( CGoodbye, PROMPT(":non-listening inform goodbye") ) //----------------------------------------------------------------------------- // // AGENT DECLARATIONS // //----------------------------------------------------------------------------- DECLARE_AGENTS( DECLARE_AGENT(CDialogTask) DECLARE_AGENT(CGiveIntroduction) DECLARE_AGENT(CGetTotalPpl) DECLARE_AGENT(CGetTotalMen) DECLARE_AGENT(CGetTotalWomen) DECLARE_AGENT(CProcessResults) DECLARE_AGENT(CGiveResults) DECLARE_AGENT(CGoodbye) ) //----------------------------------------------------------------------------- // DIALOG TASK ROOT DECLARATION //----------------------------------------------------------------------------- DECLARE_DIALOG_TASK_ROOT(DialogTask, CDialogTask, "")