python gutenberg古腾堡语料库

xiaoxiao2021-02-28  57

import nltk from nltk.corpus import gutenberg a = gutenberg.fileids() print(a) emma = gutenberg.words("shakespeare-macbeth.txt") print(emma[1030 :1037]) for fileid in gutenberg.fileids(): num_chars = len(gutenberg.raw(fileid)) num_words = len(gutenberg.words(fileid)) num_sents = len(gutenberg.sents(fileid)) print(num_chars , num_words, num_sents , fileid)
转载请注明原文地址: https://www.6miu.com/read-78367.html

最新回复(0)