How to use the chatterbot.corpus.load_corpus function in ChatterBot

To help you get started, we’ve selected a few ChatterBot examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gunthercox / chatterbot-corpus / tests / test_corpus.py View on Github external
def test_load_corpus_chinese(self):
        files = corpus.list_corpus_files('chatterbot_corpus/data/chinese')
        corpus_data = list(corpus.load_corpus(*files))

        self.assertTrue(len(corpus_data))
github gunthercox / ChatterBot / tests / test_corpus.py View on Github external
def test_load_corpus_marathi(self):
        data_files = corpus.list_corpus_files('chatterbot.corpus.marathi')
        corpus_data = corpus.load_corpus(*data_files)

        self.assertTrue(len(list(corpus_data)))
github gunthercox / ChatterBot / tests / test_corpus.py View on Github external
def test_load_corpus_chinese(self):
        data_files = corpus.list_corpus_files('chatterbot.corpus.chinese')
        corpus_data = corpus.load_corpus(*data_files)

        self.assertTrue(len(list(corpus_data)))
github gunthercox / ChatterBot / tests / test_corpus.py View on Github external
def test_load_corpus_portuguese(self):
        data_files = corpus.list_corpus_files('chatterbot.corpus.portuguese')
        corpus_data = corpus.load_corpus(*data_files)

        self.assertTrue(len(list(corpus_data)))
github gunthercox / ChatterBot / tests / test_corpus.py View on Github external
def test_load_corpus_english(self):
        file_path = os.path.join(corpus.DATA_DIRECTORY, 'english')
        data_files = corpus.list_corpus_files(file_path)
        corpus_data = corpus.load_corpus(*data_files)

        self.assertGreater(len(list(corpus_data)), 1)
github gunthercox / chatterbot-corpus / tests / test_corpus.py View on Github external
def test_load_corpus_german(self):
        files = corpus.list_corpus_files('chatterbot_corpus/data/german')
        corpus_data = list(corpus.load_corpus(*files))

        self.assertTrue(len(corpus_data))
github gunthercox / chatterbot-corpus / tests / test_corpus.py View on Github external
def test_load_corpus_indonesian(self):
        files = corpus.list_corpus_files('chatterbot_corpus/data/indonesian')
        corpus_data = list(corpus.load_corpus(*files))

        self.assertTrue(len(corpus_data))
github gunthercox / ChatterBot / tests / test_corpus.py View on Github external
def test_load_corpus_spanish(self):
        data_files = corpus.list_corpus_files('chatterbot.corpus.spanish')
        corpus_data = corpus.load_corpus(*data_files)

        self.assertTrue(len(list(corpus_data)))
github gunthercox / ChatterBot / chatterbot / trainers.py View on Github external
def train(self, *corpus_paths):
        from chatterbot.corpus import load_corpus, list_corpus_files

        data_file_paths = []

        # Get the paths to each file the bot will be trained with
        for corpus_path in corpus_paths:
            data_file_paths.extend(list_corpus_files(corpus_path))

        for corpus, categories, file_path in load_corpus(*data_file_paths):

            statements_to_create = []

            # Train the chat bot with each statement and response pair
            for conversation_count, conversation in enumerate(corpus):

                if self.show_training_progress:
                    utils.print_progress_bar(
                        'Training ' + str(os.path.basename(file_path)),
                        conversation_count + 1,
                        len(corpus)
                    )

                previous_statement_text = None
                previous_statement_search_text = ''
github gunthercox / ChatterBot / chatterbot / trainers.py View on Github external
def train(self, *corpus_paths):
        from chatterbot.corpus import load_corpus, list_corpus_files

        data_file_paths = []

        # Get the paths to each file the bot will be trained with
        for corpus_path in corpus_paths:
            data_file_paths.extend(list_corpus_files(corpus_path))

        for corpus, categories, file_path in load_corpus(*data_file_paths):

            statements_to_create = []

            # Train the chat bot with each statement and response pair
            for conversation_count, conversation in enumerate(corpus):

                if self.show_training_progress:
                    utils.print_progress_bar(
                        'Training ' + str(os.path.basename(file_path)),
                        conversation_count + 1,
                        len(corpus)
                    )

                previous_statement_text = None
                previous_statement_search_text = ''