コード例 #1
0
ファイル: sentence.cs プロジェクト: Taturevich/GraduateWork
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="bot">The bot involved in this request</param>
 /// <param name="user">The user making the request</param>
 /// <param name="query">The query that originated this node</param>
 /// <param name="request">The request inputted into the system</param>
 /// <param name="result">The result to be passed to the user</param>
 /// <param name="templateNode">The node to be processed</param>
 public sentence(Bot bot,
                 AIMLbot.User user,
                 Utils.SubQuery query,
                 Request request,
                 AIMLbot.Result result,
                 XmlNode templateNode)
     : base(bot, user, query, request, result, templateNode)
 {
 }
コード例 #2
0
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="bot">The bot involved in this request</param>
 /// <param name="user">The user making the request</param>
 /// <param name="query">The query that originated this node</param>
 /// <param name="request">The request inputted into the system</param>
 /// <param name="result">The result to be passed to the user</param>
 /// <param name="templateNode">The node to be processed</param>
 public system(AIMLbot.Bot bot,
               AIMLbot.User user,
               AIMLbot.Utils.SubQuery query,
               AIMLbot.Request request,
               AIMLbot.Result result,
               XmlNode templateNode)
     : base(bot, user, query, request, result, templateNode)
 {
 }
コード例 #3
0
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="bot">The bot involved in this request</param>
 /// <param name="user">The user making the request</param>
 /// <param name="query">The query that originated this node</param>
 /// <param name="request">The request inputted into the system</param>
 /// <param name="result">The result to be passed to the user</param>
 /// <param name="templateNode">The node to be processed</param>
 public random(Bot bot,
               AIMLbot.User user,
               Utils.SubQuery query,
               Request request,
               AIMLbot.Result result,
               XmlNode templateNode)
     : base(bot, user, query, request, result, templateNode)
 {
     isRecursive = false;
 }
コード例 #4
0
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="bot">The bot involved in this request</param>
 /// <param name="user">The user making the request</param>
 /// <param name="query">The query that originated this node</param>
 /// <param name="request">The request inputted into the system</param>
 /// <param name="result">The result to be passed to the user</param>
 /// <param name="templateNode">The node to be processed</param>
 public condition(AIMLbot.Bot bot,
                  AIMLbot.User user,
                  AIMLbot.Utils.SubQuery query,
                  AIMLbot.Request request,
                  AIMLbot.Result result,
                  XmlNode templateNode)
     : base(bot, user, query, request, result, templateNode)
 {
     this.isRecursive = false;
 }
コード例 #5
0
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="bot">The bot involved in this request</param>
 /// <param name="user">The user making the request</param>
 /// <param name="query">The query that originated this node</param>
 /// <param name="request">The request inputted into the system</param>
 /// <param name="result">The result to be passed to the user</param>
 /// <param name="templateNode">The node to be processed</param>
 public javascript(AIMLbot.Bot bot,
                   AIMLbot.User user,
                   AIMLbot.Utils.SubQuery query,
                   AIMLbot.Request request,
                   AIMLbot.Result result,
                   XmlNode templateNode)
     : base(bot, user, query, request, result, templateNode)
 {
     // Preprocess javascript, return result and then process result
     this.isRecursive = false;
 }
コード例 #6
0
ファイル: TagTester.cs プロジェクト: kjunghans/AIMLBot
        //public AIMLbot.Request mockRequest;
        //public AIMLbot.Result mockResult;
        //public AIMLbot.Utils.SubQuery mockQuery;

        public TagTester()
        {
            this.mockBot = new Bot();
            this.mockBot.loadSettings();
            this.mockBot.loadAIMLFromFiles();
            this.mockUser = new User("1", this.mockBot);
            //mockRequest = new Request("This is a test", this.mockUser, this.mockBot);
            //this.mockQuery = new AIMLbot.Utils.SubQuery("This is a test <that> * <topic> *");
            //this.mockQuery.InputStar.Insert(0, "first star");
            //this.mockQuery.InputStar.Insert(0, "second star");
            //mockResult = new Result(this.mockUser, this.mockBot, mockRequest);
        }
コード例 #7
0
ファイル: AIMLTagHandler.cs プロジェクト: cucacutexice/AIGA
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="bot">The bot involved in this request</param>
 /// <param name="user">The user making the request</param>
 /// <param name="query">The query that originated this node</param>
 /// <param name="request">The request itself</param>
 /// <param name="result">The result to be passed back to the user</param>
 /// <param name="templateNode">The node to be processed</param>
 public AIMLTagHandler(AIMLbot.Bot bot,
                       AIMLbot.User user,
                       AIMLbot.Utils.SubQuery query,
                       AIMLbot.Request request,
                       AIMLbot.Result result,
                       XmlNode templateNode) : base(bot, templateNode.OuterXml)
 {
     this.user         = user;
     this.query        = query;
     this.request      = request;
     this.result       = result;
     this.templateNode = templateNode;
 }
コード例 #8
0
        private void ucConfigurationButton1_Click(object sender, EventArgs e)
        {
            using (FormOptions form = new FormOptions()) {
                form.SetConfiguration(_cf, this);

                if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    _bot  = null;
                    _user = null;

                    SetConfiguration(form.GetConfiguration());
                }
            }
        }
コード例 #9
0
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="bot">The bot involved in this request</param>
 /// <param name="user">The user making the request</param>
 /// <param name="query">The query that originated this node</param>
 /// <param name="request">The request itself</param>
 /// <param name="result">The result to be passed back to the user</param>
 /// <param name="templateNode">The node to be processed</param>
 public AIMLTagHandler(Bot bot,
                       AIMLbot.User user,
                       AIMLbot.Utils.SubQuery query,
                       Request request,
                       AIMLbot.Result result,
                       XmlNode templateNode) : base(bot, templateNode.OuterXml)
 {
     this.user         = user;
     this.query        = query;
     this.request      = request;
     this.result       = result;
     this.templateNode = templateNode;
     this.templateNode.Attributes.RemoveNamedItem("xmlns");
 }
コード例 #10
0
ファイル: AIMLTagHandler.cs プロジェクト: abhishek-kumar/AIGA
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="bot">The bot involved in this request</param>
 /// <param name="user">The user making the request</param>
 /// <param name="query">The query that originated this node</param>
 /// <param name="request">The request itself</param>
 /// <param name="result">The result to be passed back to the user</param>
 /// <param name="templateNode">The node to be processed</param>
 public AIMLTagHandler(   AIMLbot.Bot bot, 
     AIMLbot.User user,
     AIMLbot.Utils.SubQuery query,
     AIMLbot.Request request,
     AIMLbot.Result result,
     XmlNode templateNode)
     : base(bot,templateNode.OuterXml)
 {
     this.user = user;
     this.query = query;
     this.request = request;
     this.result = result;
     this.templateNode = templateNode;
 }
コード例 #11
0
        public override void SetConfiguration(PluginV1 cf)
        {
            cf.STORAGE.AddIfNotExist(ConfigTitles.RESPONSE_VARIABLE, "$BotResponse");
            cf.STORAGE.AddIfNotExist(ConfigTitles.RESPONSE_SCRIPT, string.Empty);
            cf.STORAGE.AddIfNotExist(ConfigTitles.RESPONSE_XML, string.Empty);
            cf.STORAGE.AddIfNotExist(ConfigTitles.CONFIG_ROOT_FOLDER, EZ_Builder.Common.CombinePath(EZ_Builder.Constants.PLUGINS_FOLDER, cf._pluginGUID));

            EZ_Builder.Scripting.VariableManager.SetVariable(cf.STORAGE[ConfigTitles.RESPONSE_VARIABLE].ToString(), string.Empty);

            if (_bot == null)
            {
                try {
                    string configRootFolder = cf.STORAGE[ConfigTitles.CONFIG_ROOT_FOLDER].ToString();

                    string aimlFolder = EZ_Builder.Common.CombinePath(configRootFolder, "aiml");

                    string configFolder = EZ_Builder.Common.CombinePath(configRootFolder, "config");

                    string settingsFile = EZ_Builder.Common.CombinePath(configRootFolder, "config", "Settings.xml");

                    EZ_Builder.Invokers.SetAppendText(tbLog, false, "Loading AIM configuration... ");

                    _bot                   = new AIMLbot.Bot();
                    _bot.PathToAIML        = aimlFolder;
                    _bot.PathToConfigFiles = configFolder;
                    _bot.loadSettings(settingsFile);
                    _bot.loadAIMLFromFiles();
                    _bot.isAcceptingUserInput = true;
                    _bot.WrittenToLog        += _bot_WrittenToLog;

                    _user = new AIMLbot.User("DJ", _bot);

                    EZ_Builder.Invokers.SetAppendText(tbLog, true, "Success!");
                } catch (Exception ex) {
                    EZ_Builder.Invokers.SetAppendText(tbLog, true, ex.ToString());
                }
            }

            base.SetConfiguration(cf);
        }
コード例 #12
0
 private static void Talk(String toWhom, String komunikat)
 {
     AIMLbot.User myUser = new AIMLbot.User(toWhom, myBot);
     if (najblizszeZrodlo != null)
         if ((myEnergy < cennikSwiata.initialEnergy - ZnanaMapa.znajdzPole(najblizszeZrodlo.x,
                     najblizszeZrodlo.y).getEnergia()) || (myEnergy < kosztDoZrodla
                     + 2 * cennikSwiata.speakCost))
             return;
     AIMLbot.Request r = new AIMLbot.Request(komunikat, myUser, myBot);
     AIMLbot.Result res = myBot.Chat(r);
     if ((res.Output == "")||(res.Output == "Nie rozumiem!"))
     {
         czyRozmawiam = false;
         return;
     }
     Console.WriteLine("Ja: " + res.Output);
     Speak(res.Output);
 }
コード例 #13
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Chatbot.Trigger"/> class.
        /// </summary>
        /// <param name="Chatbot">Chatbot.</param>
        public void Initialize(GameObject tmpchatbot)
        {
            // Save delivered GameObject
            chatbot = tmpchatbot;
            // Throw error if not Game Object delivered
            if (!chatbot)
            {
                Debug.LogWarning("To use chatbot you need to attatch ChatbotCore.cs script to a GameObject and pass GameObject to Chatbot. GameObject is empty.");
            }
            // Windows, Linux and Mac OSX
                        #if !(UNITY_WEBPLAYER || UNITY_WEBGL)
            else
            {
                // Initialize Program # variables
                bot     = new AIMLbot.Bot(this);
                user    = new AIMLbot.User("User", bot);
                request = new AIMLbot.Request("", user, bot);
                result  = new AIMLbot.Result(user, bot, request);
                // Global Settings
                Setting[] settings;
                // Gather all attatched settings from Scene
                settings = chatbot.GetComponentsInChildren <Setting>();
                // Loop through settings and
                foreach (Setting setting in settings)
                {
                    // Set global settings in Program# and Jurassic
                    SetGlobalSetting(setting.gameObject.name, setting.value);
                }
                // Load Settings from Scene Setting Components.
                bot.loadSettingsFromScene();
                // Load AIML files from AIML path defined in Settings.xml
                bot.loadAIMLFromFiles();

                // Define to or not to use JavaScript (Jurassic) in AIML
                bot.UseJavaScript = true;
                // Use Program # with Jurassic and Chatbot
                bot.ProgramSharpJSWithChatbot = true;
                // Create Triggers instance
                trigger = new Chatbot.Triggers();
                // Initializes triggers that are attatched
                // to the Chatbot. Needs to pass the
                // Chatbot Gameobject and Triggers instance
                trigger.Initialize(chatbot, this);
                // Create Motives instance
                motive = new Chatbot.Motives();
                // Initialize it
                motive.Initialize(chatbot);
                // Create Planner instance
                planner = new Chatbot.NestedPlanner();
                // Initialize planner
                planner.Initialize(chatbot, this, motive);
            }
                        #else
            // Webplayer plattform or WebGl
            ProgramSharpWebplayerCoroutine WebplayerCoroutine = chatbot.GetComponent <ProgramSharpWebplayerCoroutine>();
            if (WebplayerCoroutine != null && chatbot != null)
            {
                // Load settings from scene
                bot     = new AIMLbot.Bot(WebplayerCoroutine, Application.dataPath + "/Chatbot/Program #/advancedconfig/Settings.xml", true, this);
                user    = new AIMLbot.User("User", bot);
                request = new AIMLbot.Request("", user, bot);
                result  = new AIMLbot.Result(user, bot, request);

                // Define to or not to use JavaScript (Jurassic) in AIML
                bot.UseJavaScript = true;
                // Use Program # with Jurassic and Chatbot
                bot.ProgramSharpJSWithChatbot = true;
                // Create Triggers instance
                trigger = new Chatbot.Triggers();
                // Initializes triggers that are attatched
                // to the Chatbot. Needs to pass the
                // Chatbot Gameobject and Triggers instance
                trigger.Initialize(chatbot, this);
                // Create Motives instance
                motive = new Chatbot.Motives();
                // Initialize it
                motive.Initialize(chatbot);
                // Create Planner instance
                planner = new Chatbot.NestedPlanner();
                // Initialize planner
                planner.Initialize(chatbot, this, motive);
            }
            else
            {
                Debug.LogWarning("You need to attatch the Webplayer Component in Webplayer plattform mode.");
            }
                        #endif
        }