How to use the chatterbot.comparisons 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 / tests / test_benchmarks.py View on Github external
def test_levenshtein_distance_comparisons(self):
        """
        Test the levenshtein distance comparison algorithm.
        """
        self.chatbot.logic_adapters[0] = BestMatch(
            self.chatbot,
            statement_comparison_function=comparisons.LevenshteinDistance,
            response_selection_method=response_selection.get_first_response
        )

        trainer = get_list_trainer(self.chatbot)
        trainer.train(STATEMENT_LIST)

        self.assert_response_duration_is_less_than(1)
github gunthercox / ChatterBot / tests / test_benchmarks.py View on Github external
def test_spacy_similarity_comparisons(self):
        """
        Test the spacy similarity comparison algorithm.
        """
        self.chatbot.logic_adapters[0] = BestMatch(
            self.chatbot,
            statement_comparison_function=comparisons.SpacySimilarity,
            response_selection_method=response_selection.get_first_response
        )

        trainer = get_list_trainer(self.chatbot)
        trainer.train(STATEMENT_LIST)

        self.assert_response_duration_is_less_than(3)
github gunthercox / ChatterBot / tests / test_benchmarks.py View on Github external
def test_spacy_similarity_comparisons(self):
        """
        Test the spacy similarity comparison algorithm.
        """
        self.chatbot.logic_adapters[0] = BestMatch(
            self.chatbot,
            statement_comparison_function=comparisons.SpacySimilarity,
            response_selection_method=response_selection.get_first_response
        )

        trainer = get_list_trainer(self.chatbot)
        trainer.train(STATEMENT_LIST)

        self.assert_response_duration_is_less_than(3)
github gunthercox / ChatterBot / tests / __init__.py View on Github external
def setup_module():
    chatbot = ChatBot('setup')

    chatbot.logic_adapters = [
        LogicAdapter(
            chatbot,
            statement_comparison_function=comparisons.jaccard_similarity
        ),
        LogicAdapter(
            chatbot,
            statement_comparison_function=comparisons.synset_distance
        ),
    ]

    chatbot.initialize()
github gunthercox / ChatterBot / tests / test_search.py View on Github external
def setUp(self):
        super().setUp()
        self.search_algorithm = IndexedTextSearch(
            self.chatbot,
            statement_comparison_function=comparisons.LevenshteinDistance
        )
github gunthercox / ChatterBot / tests / test_comparisons.py View on Github external
def setUp(self):
        super().setUp()

        self.compare = comparisons.SpacySimilarity(
            language=languages.ENG
        )
github gunthercox / ChatterBot / tests / test_benchmarks.py View on Github external
def test_levenshtein_distance_comparisons(self):
        """
        Test the levenshtein distance comparison algorithm.
        """
        self.chatbot.logic_adapters[0] = BestMatch(
            self.chatbot,
            statement_comparison_function=comparisons.LevenshteinDistance,
            response_selection_method=response_selection.get_first_response
        )

        trainer = get_list_trainer(self.chatbot)
        trainer.train(STATEMENT_LIST)

        self.assert_response_duration_is_less_than(1)
github gunthercox / ChatterBot / tests / test_comparisons.py View on Github external
def setUp(self):
        super().setUp()

        self.compare = comparisons.JaccardSimilarity(
            language=languages.ENG
        )
github gunthercox / ChatterBot / tests / __init__.py View on Github external
def setup_module():
    chatbot = ChatBot('setup')

    chatbot.logic_adapters = [
        LogicAdapter(
            chatbot,
            statement_comparison_function=comparisons.jaccard_similarity
        ),
        LogicAdapter(
            chatbot,
            statement_comparison_function=comparisons.synset_distance
        ),
    ]

    chatbot.initialize()
github gunthercox / ChatterBot / tests / test_comparisons.py View on Github external
def setUp(self):
        super().setUp()

        self.compare = comparisons.LevenshteinDistance(
            language=languages.ENG
        )