def test_categories(self): self.assertEqual( ptb.categories(), [ 'adventure', 'belles_lettres', 'fiction', 'humor', 'lore', 'mystery', 'news', 'romance', 'science_fiction', ], )
def test_categories(self): self.assertEqual( ptb.categories(), [ "adventure", "belles_lettres", "fiction", "humor", "lore", "mystery", "news", "romance", "science_fiction", ], )
def verify_ptb_install(): # Download PTB metadata assert (nltk.download('ptb')) import hashlib from nltk.corpus import ptb # Be sure we have the category list assert ('news' in ptb.categories()) m = hashlib.md5() # NOT SECURE! m.update(','.join(ptb.fileids()).encode('utf8')) if m.hexdigest() == 'e3b49c6df5529560b2945e6a4715f9b0': print('Penn Treebank succesfully installed!') return True else: print('Error installing Penn Treebank (hash mismatch).') print('It may still work - try loading it in NLTK.') return False
def verify_ptb_install(): # Download PTB metadata assert(nltk.download('ptb')) import hashlib from nltk.corpus import ptb # Be sure we have the category list assert('news' in ptb.categories()) m = hashlib.md5() # NOT SECURE! m.update(','.join(ptb.fileids()).encode('utf8')) if m.hexdigest() == 'e3b49c6df5529560b2945e6a4715f9b0': print('Penn Treebank succesfully installed!') return True else: print('Error installing Penn Treebank (hash mismatch).') print('It may still work - try loading it in NLTK.') return False
def test_categories(self): self.assertEqual( ptb.categories(), ['adventure', 'belles_lettres', 'fiction', 'humor', 'lore', 'mystery', 'news', 'romance', 'science_fiction'] )