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')
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')
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')
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')
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')
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')
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')
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')
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))
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('')
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)
def test_nltk_download_corpus(self): downloaded = utils.nltk_download_corpus('wordnet') self.assertTrue(downloaded) self.skipTest('Test needs to be created')
def initialize_nltk_stopwords(self): """ Download required NLTK corpora if they have not already been downloaded. """ utils.nltk_download_corpus('corpora/stopwords')
def initialize_nltk_punkt(self): """ Download required NLTK corpora if they have not already been downloaded. """ utils.nltk_download_corpus('tokenizers/punkt')
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')
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')