Example #1
0
    def initialize_nltk_wordnet(self):
        """
        Download required NLTK corpora if they have not already been downloaded.
        """
        from chatterbot.utils import nltk_download_corpus

        nltk_download_corpus('corpora/wordnet')
Example #2
0
    def initialize_nltk_punkt(self):
        """
        Download required NLTK corpora if they have not already been downloaded.
        """
        from chatterbot.utils import nltk_download_corpus

        nltk_download_corpus('tokenizers/punkt')
Example #3
0
    def initialize_nltk_punkt(self):
        """
        Download required NLTK corpora if they have not already been downloaded.
        """
        from chatterbot.utils import nltk_download_corpus

        nltk_download_corpus('tokenizers/punkt')
Example #4
0
    def initialize_nltk_punkt(self):
        """
        Download required NLTK punkt corpus if it has not already been downloaded.
        """
        from chatterbot.utils import nltk_download_corpus

        nltk_download_corpus('punkt')
Example #5
0
    def initialize_nltk_stopwords(self):
        """
        Download required NLTK corpora if they have not already been downloaded.
        """
        from chatterbot.utils import nltk_download_corpus

        nltk_download_corpus('corpora/stopwords')
Example #6
0
    def initialize_nltk_stopwords(self):
        """
        Download required NLTK stopwords corpus if it has not already been downloaded.
        """
        from chatterbot.utils import nltk_download_corpus

        nltk_download_corpus('stopwords')
Example #7
0
    def initialize_nltk_wordnet(self):
        """
        Download the NLTK wordnet corpora that is required for this algorithm
        to run only if the corpora has not already been downloaded.
        """
        from chatterbot.utils import nltk_download_corpus

        nltk_download_corpus('corpora/wordnet')
Example #8
0
    def initialize_nltk_vader_lexicon(self):
        """
        Download the NLTK vader lexicon for sentiment analysis
        that is required for this algorithm to run.
        """
        from chatterbot.utils import nltk_download_corpus

        nltk_download_corpus('sentiment/vader_lexicon')
Example #9
0
    def initialize_nltk_wordnet(self):
        """
        Download the NLTK wordnet corpora that is required for this algorithm
        to run only if the corpora has not already been downloaded.
        """
        from chatterbot.utils import nltk_download_corpus

        nltk_download_corpus('corpora/wordnet')
Example #10
0
    def initialize_nltk_averaged_perceptron_tagger(self):
        """
        Download the NLTK averaged perceptron tagger that is required for this algorithm
        to run only if the corpora has not already been downloaded.
        """
        from chatterbot.utils import nltk_download_corpus

        nltk_download_corpus('averaged_perceptron_tagger')
Example #11
0
    def initialize_nltk_averaged_perceptron_tagger(self):
        """
        Download the NLTK averaged perceptron tagger that is required for this algorithm
        to run only if the corpora has not already been downloaded.
        """
        from chatterbot.utils import nltk_download_corpus

        nltk_download_corpus('averaged_perceptron_tagger')
Example #12
0
    def initialize_nltk_vader_lexicon(self):
        """
        Download the NLTK vader lexicon for sentiment analysis
        that is required for this algorithm to run.
        """
        from chatterbot.utils import nltk_download_corpus

        nltk_download_corpus('sentiment/vader_lexicon')
Example #13
0
    def test_remove_stop_words(self):
        from chatterbot.utils import nltk_download_corpus

        nltk_download_corpus('stopwords')

        tokens = ['this', 'is', 'a', 'test', 'string']
        words = utils.remove_stopwords(tokens, 'english')

        # This example list of words should end up with only two elements
        self.assertEqual(len(words), 2)
        self.assertIn('test', list(words))
        self.assertIn('string', list(words))
Example #14
0
    def __init__(self, language='english'):
        from chatterbot.utils import nltk_download_corpus

        self.punctuation_table = str.maketrans(
            dict.fromkeys(string.punctuation))

        # Download the stopwords corpus if needed
        nltk_download_corpus('stopwords')

        # Get list of stopwords from the NLTK corpus
        self.stopwords = nltk.corpus.stopwords.words(language)
        self.stopwords.append('')
Example #15
0
    def test_remove_stop_words(self):
        from chatterbot.utils import nltk_download_corpus

        nltk_download_corpus('stopwords')

        tokens = ['this', 'is', 'a', 'test', 'string']
        words = utils.remove_stopwords(tokens, 'english')

        # This example list of words should end up with only two elements
        self.assertEqual(len(words), 2)
        self.assertIn('test', list(words))
        self.assertIn('string', list(words))
Example #16
0
    def setUp(self):
        from chatterbot.utils import nltk_download_corpus

        nltk_download_corpus('stopwords')
        nltk_download_corpus('wordnet')
        nltk_download_corpus('punkt')

        self.adapter = ClosestMeaningAdapter()

        # Add a mock storage adapter to the logic adapter
        self.adapter.set_chatbot(MockChatBot())
    def setUp(self):
        super(BestMatchSynsetDistanceTestCase, self).setUp()
        from chatterbot.utils import nltk_download_corpus
        from chatterbot.comparisons import synset_distance

        nltk_download_corpus('stopwords')
        nltk_download_corpus('wordnet')
        nltk_download_corpus('punkt')

        self.adapter = BestMatch(statement_comparison_function=synset_distance)

        # Add a mock storage adapter to the logic adapter
        self.adapter.set_chatbot(self.chatbot)
    def setUp(self):
        super(BestMatchSynsetDistanceTestCase, self).setUp()
        from chatterbot.utils import nltk_download_corpus
        from chatterbot.comparisons import synset_distance

        nltk_download_corpus('stopwords')
        nltk_download_corpus('wordnet')
        nltk_download_corpus('punkt')

        self.adapter = BestMatch(
            statement_comparison_function=synset_distance
        )

        # Add a mock storage adapter to the logic adapter
        self.adapter.set_chatbot(self.chatbot)
Example #19
0
 def test_nltk_download_corpus(self):
     downloaded = utils.nltk_download_corpus('wordnet')
     self.assertTrue(downloaded)
     self.skipTest('Test needs to be created')
Example #20
0
 def initialize_nltk_stopwords(self):
     """
     Download required NLTK corpora if they have not already been downloaded.
     """
     utils.nltk_download_corpus('corpora/stopwords')
Example #21
0
 def initialize_nltk_punkt(self):
     """
     Download required NLTK corpora if they have not already been downloaded.
     """
     utils.nltk_download_corpus('tokenizers/punkt')
Example #22
0
 def initialize_nltk_vader_lexicon(self):
     """
     Download the NLTK vader lexicon for sentiment analysis
     that is required for this algorithm to run.
     """
     utils.nltk_download_corpus('vader_lexicon')
Example #23
0
 def test_nltk_download_corpus(self):
     downloaded = utils.nltk_download_corpus('wordnet')
     self.assertTrue(downloaded)
     self.skipTest('Test needs to be created')
Example #24
0
 def test_nltk_download_corpus(self):
     downloaded = utils.nltk_download_corpus('wordnet')
     self.assertTrue(downloaded)
 def initialize_nltk_stopwords(self):
     """
     Download required NLTK stopwords corpus if it has not already been downloaded.
     """
     utils.nltk_download_corpus('stopwords')
 def initialize_nltk_punkt(self):
     """
     Download required NLTK punkt corpus if it has not already been downloaded.
     """
     utils.nltk_download_corpus('punkt')