How to use the chatterbot.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_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_telugu(self):
        data_files = corpus.list_corpus_files('chatterbot.corpus.telugu')
        corpus_data = corpus.load_corpus(*data_files)

        self.assertTrue(len(list(corpus_data)))
github gunthercox / chatterbot-corpus / tests / test_data.py View on Github external
def test_character_count(self):
        """
        Test that no line in the corpus exceeds the maximum number of characters.
        """
        files = corpus.list_corpus_files('chatterbot_corpus')

        for dialog_corpus, _categories, _file_path in corpus.load_corpus(*files):
            for conversation in dialog_corpus:
                for text in conversation:
                    if len(text) > STATEMENT_TEXT_MAX_LENGTH:
                        self.fail(
                            '"{}" cannot be longer than {} characters'.format(
                                text,
                                STATEMENT_TEXT_MAX_LENGTH
                            )
github gunthercox / chatterbot-corpus / tests / test_corpus.py View on Github external
def test_load_english_corpus_categories(self):
        files = corpus.list_corpus_files('chatterbot_corpus/data/english/greetings.yml')
        corpus_data = list(corpus.load_corpus(*files))

        self.assertEqual(len(corpus_data), 1)

        # Test that each conversation gets labeled with the correct category
        for conversation in corpus_data:
            self.assertIn('greetings', conversation[1])
github gunthercox / ChatterBot / tests / test_corpus.py View on Github external
def test_get_file_path(self):
        """
        Test that a dotted path is properly converted to a file address.
        """
        path = corpus.get_file_path('chatterbot.corpus.english')
        self.assertIn(
            os.path.join('chatterbot_corpus', 'data', 'english'),
            path
        )
github gunthercox / chatterbot-corpus / tests / test_corpus.py View on Github external
def test_get_file_path(self):
        """
        Test that a dotted path is properly converted to a file address.
        """
        path = corpus.get_file_path('chatterbot.corpus.english')
        self.assertIn(
            os.path.join('chatterbot_corpus', 'data', 'english'),
            path
        )
github gunthercox / chatterbot-corpus / tests / test_data.py View on Github external
def test_character_count(self):
        """
        Test that no line in the corpus exceeds the maximum number of characters.
        """
        files = corpus.list_corpus_files('chatterbot_corpus')

        for dialog_corpus, _categories, _file_path in corpus.load_corpus(*files):
            for conversation in dialog_corpus:
                for text in conversation:
                    if len(text) > STATEMENT_TEXT_MAX_LENGTH:
                        self.fail(
                            '"{}" cannot be longer than {} characters'.format(
                                text,
                                STATEMENT_TEXT_MAX_LENGTH
                            )
github gunthercox / ChatterBot / tests / test_corpus.py View on Github external
def test_load_corpus_english_greetings(self):
        file_path = os.path.join(corpus.DATA_DIRECTORY, 'english', 'greetings.yml')
        data_files = corpus.list_corpus_files(file_path)
        corpus_data = corpus.load_corpus(*data_files)

        self.assertEqual(len(list(corpus_data)), 1)
github gunthercox / ChatterBot / tests / test_corpus.py View on Github external
def test_read_english_corpus(self):
        corpus_path = os.path.join(
            corpus.DATA_DIRECTORY,
            'english', 'conversations.yml'
        )
        data = corpus.read_corpus(corpus_path)
        self.assertIn('conversations', data)
github gunthercox / chatterbot-corpus / tests / test_corpus.py View on Github external
def test_load_corpus_telugu(self):
        files = corpus.list_corpus_files('chatterbot_corpus/data/telugu')
        corpus_data = list(corpus.load_corpus(*files))

        self.assertTrue(len(corpus_data))