首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >AIMLBot C#拯救大脑

AIMLBot C#拯救大脑
EN

Stack Overflow用户
提问于 2012-06-25 15:18:07
回答 1查看 2.1K关注 0票数 0

我在c#中使用AIMLbot.dll。我看到了两个函数saveToBinaryFileloadFromBinaryFile。我认为这些功能是将机器人大脑中的当前内容存储到一个文件中。但它似乎不起作用!意思是,如果我说记住我的名字并将内容保存到GraphMaster.dat文件中。下一次我加载相同文件的内容时,当我问我的名字时,它给出了错误的答案。我的类如下所示。

代码语言:javascript
复制
class AIBot
    {
        private Bot myBot;
        private User myUser;

        public AIBot()
        {
            myBot = new Bot();
            myUser = new User("UnknownUser", myBot);
        }

        public void Initialize()
        {
            myBot.loadSettings();
            myBot.isAcceptingUserInput = false;
            myBot.loadAIMLFromFiles();
            myBot.isAcceptingUserInput = true;
        }

        public void Load()
        {
            if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + @"\Graphmaster.dat"))
                myBot.loadFromBinaryFile(AppDomain.CurrentDomain.BaseDirectory + @"\Graphmaster.dat");
        }

        public string GetResponse(string input)
        {
            Request r = new Request(input, myUser, myBot);
            Result res = myBot.Chat(r);
            return (res.Output);
        }

        public void Save()
        {
            myBot.saveToBinaryFile(AppDomain.CurrentDomain.BaseDirectory + @"\Graphmaster.dat");
        }
    }

有谁能帮忙指出这个问题吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-06-25 15:37:42

我有一个解决这个问题的办法。希望能对其他人有所帮助。

  1. 保存用户会话,如

下次对存储的会话执行this.myUser.Predicates.DictionaryAsXML.Save(saveFileDialogDump.FileName);

  • Load命令。

this.myUser.Predicates.loadSettings(openFileDialogDump.FileName);

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11184984

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档