当前位置: 首页>>代码示例>>Python>>正文


Python trainers.ListTrainer方法代码示例

本文整理汇总了Python中chatterbot.trainers.ListTrainer方法的典型用法代码示例。如果您正苦于以下问题:Python trainers.ListTrainer方法的具体用法?Python trainers.ListTrainer怎么用?Python trainers.ListTrainer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在chatterbot.trainers的用法示例。


在下文中一共展示了trainers.ListTrainer方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: tariner

# 需要导入模块: from chatterbot import trainers [as 别名]
# 或者: from chatterbot.trainers import ListTrainer [as 别名]
def tariner(asay):
    momo.set_trainer(ListTrainer)
    while True:
        conv = []
        conv.append(asay)
        bsay = B(asay)
        conv.append(bsay)
        momo.train(conv)
        print(conv)
        conv = []
        conv.append(bsay)
        asay = A(bsay)
        conv.append(asay)
        momo.train(conv)
        print(conv)
        sleep(5)  # 控制频率 
开发者ID:gusibi,项目名称:momo,代码行数:18,代码来源:tuling_trainer.py

示例2: setUp

# 需要导入模块: from chatterbot import trainers [as 别名]
# 或者: from chatterbot.trainers import ListTrainer [as 别名]
def setUp(self):
        super().setUp()

        self.chatbot.logic_adapters = [
            DummyMutatorLogicAdapter(self.chatbot)
        ]

        self.trainer = ListTrainer(
            self.chatbot,
            show_training_progress=False
        )

        self.trainer.train([
            'Hello',
            'How are you?'
        ]) 
开发者ID:gunthercox,项目名称:ChatterBot,代码行数:18,代码来源:test_data_cache.py

示例3: __init__

# 需要导入模块: from chatterbot import trainers [as 别名]
# 或者: from chatterbot.trainers import ListTrainer [as 别名]
def __init__(self, bot):
        self.bot = bot
        self.settings = dataIO.load_json("data/chatterbot/settings.json")
        self.log = dataIO.load_json("data/chatterbot/log.json")
        self.chatbot = chatterbot.ChatBot("redbot", 
                                          storage_adapter="chatterbot.storage.MongoDatabaseAdapter",
                                          # database="data/chatterbot/db",
                                          logic_adapters=[
                                          "chatterbot.logic.BestMatch",
                                          "chatterbot.logic.TimeLogicAdapter",
                                          "chatterbot.logic.MathematicalEvaluation"]
                                          )
        self.chatbot.set_trainer(ListTrainer) 
开发者ID:TrustyJAID,项目名称:Trusty-cogs-archive,代码行数:15,代码来源:chatterbot.py

示例4: setup

# 需要导入模块: from chatterbot import trainers [as 别名]
# 或者: from chatterbot.trainers import ListTrainer [as 别名]
def setup(bot):
    check_folders()
    check_files()
    if not chatt:
        bot.pip_install("chatterbot")
        import chatterbot
        from chatterbot.trainers import ListTrainer
    bot.add_cog(Chatterbot(bot)) 
开发者ID:TrustyJAID,项目名称:Trusty-cogs-archive,代码行数:10,代码来源:chatterbot.py

示例5: train

# 需要导入模块: from chatterbot import trainers [as 别名]
# 或者: from chatterbot.trainers import ListTrainer [as 别名]
def train(name, data):
    bot = getBot(name)
    bot.set_trainer(ListTrainer)
    bot.train(data) 
开发者ID:tech-quantum,项目名称:sia-cog,代码行数:6,代码来源:chatbot.py

示例6: set_momo_answer

# 需要导入模块: from chatterbot import trainers [as 别名]
# 或者: from chatterbot.trainers import ListTrainer [as 别名]
def set_momo_answer(conversation):
    momo_chat.set_trainer(ListTrainer)
    momo_chat.train(conversation) 
开发者ID:gusibi,项目名称:momo,代码行数:5,代码来源:helper.py

示例7: get_list_trainer

# 需要导入模块: from chatterbot import trainers [as 别名]
# 或者: from chatterbot.trainers import ListTrainer [as 别名]
def get_list_trainer(chatbot):
    return ListTrainer(
        chatbot,
        show_training_progress=False
    ) 
开发者ID:gunthercox,项目名称:ChatterBot,代码行数:7,代码来源:test_benchmarks.py

示例8: test_filter_selection

# 需要导入模块: from chatterbot import trainers [as 别名]
# 或者: from chatterbot.trainers import ListTrainer [as 别名]
def test_filter_selection(self):
        """
        Test that repetitive responses are filtered out of the results.
        """
        from chatterbot.conversation import Statement
        from chatterbot.trainers import ListTrainer

        self.chatbot.filters = (filters.get_recent_repeated_responses, )

        self.trainer = ListTrainer(
            self.chatbot,
            show_training_progress=False
        )

        self.trainer.train([
            'Hi',
            'Hello',
            'Hi',
            'Hello',
            'Hi',
            'Hello',
            'How are you?',
            'I am good',
            'Glad to hear',
            'How are you?'
        ])

        statement = Statement(text='Hello', conversation='training')
        first_response = self.chatbot.get_response(statement)
        second_response = self.chatbot.get_response(statement)

        self.assertEqual('How are you?', first_response.text)
        self.assertEqual('Hi', second_response.text) 
开发者ID:gunthercox,项目名称:ChatterBot,代码行数:35,代码来源:test_filters.py

示例9: setUp

# 需要导入模块: from chatterbot import trainers [as 别名]
# 或者: from chatterbot.trainers import ListTrainer [as 别名]
def setUp(self):
        super().setUp()
        self.trainer = ListTrainer(
            self.chatbot,
            show_training_progress=False
        ) 
开发者ID:gunthercox,项目名称:ChatterBot,代码行数:8,代码来源:test_list_training.py

示例10: __init__

# 需要导入模块: from chatterbot import trainers [as 别名]
# 或者: from chatterbot.trainers import ListTrainer [as 别名]
def __init__(self, bot):
        self.bot = bot
        default_guild = {
            "auto_train": False,
            "blacklist": [],
            "whitelist": [],
            "auto_response": False,
        }
        default_channel = {"message": None, "author": None}
        self.config = Config.get_conf(self, 218773382617890828)
        self.config.register_guild(**default_guild)
        self.config.register_channel(**default_channel)
        # https://github.com/bobloy/Fox-V3/blob/master/chatter/chat.py
        path = cog_data_path(self)
        data_path = path / "database.sqlite3"
        self.chatbot = ChatBot(
            "ChatterBot",
            storage_adapter="chatterbot.storage.SQLStorageAdapter",
            database=str(data_path),
            statement_comparison_function=levenshtein_distance,
            response_selection_method=get_first_response,
            logic_adapters=[
                {"import_path": "chatterbot.logic.BestMatch", "default_response": ":thinking:"}
            ],
        )
        self.trainer = ListTrainer(self.chatbot) 
开发者ID:TrustyJAID,项目名称:Trusty-cogs,代码行数:28,代码来源:chatter.py


注:本文中的chatterbot.trainers.ListTrainer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。