Python nltk.corpus.gutenberg.fileids() Examples

The following are 1 code examples of nltk.corpus.gutenberg.fileids(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module nltk.corpus.gutenberg , or try the search function .
Example #1
Source File: nltk_utils.py    From combine-FEVER-NSMN with MIT License 5 votes vote down vote up
def get_nltk_freq_words():
    """Use Brown corpus frequent words
    More corpora: https://www.nltk.org/book/ch02.html
    """
    freq_dict = nltk.FreqDist(brown.words())

    for fileid in gutenberg.fileids():
        freq_dict.update(nltk.FreqDist(gutenberg.words(fileid)))

    freq_words = [k for k, v in freq_dict.items() if v > 10]
    return freq_words, freq_dict