當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。