本文整理汇总了Python中nltk.corpus.util.LazyCorpusLoader.entries方法的典型用法代码示例。如果您正苦于以下问题:Python LazyCorpusLoader.entries方法的具体用法?Python LazyCorpusLoader.entries怎么用?Python LazyCorpusLoader.entries使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nltk.corpus.util.LazyCorpusLoader
的用法示例。
在下文中一共展示了LazyCorpusLoader.entries方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: dictionary_backoff
# 需要导入模块: from nltk.corpus.util import LazyCorpusLoader [as 别名]
# 或者: from nltk.corpus.util.LazyCorpusLoader import entries [as 别名]
def dictionary_backoff(option_tone, backoff):
'''Creates a dictionary according to the option: tonal/nontonal'''
if option_tone == "tonal":
bambara_dict_toolbox = BambaraTagging("cookbook/bambara", ["bamadaba.txt"], option_tone, "POS")
bambara_dict_toolbox.copy_files()
reader = LazyCorpusLoader("cookbook/bambara/", ToolboxCorpusReader, ["bamadaba.txt"])
entries = reader.entries("bamadaba.txt") #tonal
words = reader.words("bamadaba.txt")#tonal
pos = reader.words("bamadaba.txt", key="ps")#tonal
else:
bambara_dict_toolbox = BambaraTagging("cookbook/bambara", ["bamadaba_non_tonal.txt"], option_tone, "POS")
bambara_dict_toolbox.copy_files()
reader = LazyCorpusLoader("cookbook/bambara/", ToolboxCorpusReader, ["bamadaba_non_tonal.txt"])
entries = reader.entries("bamadaba_non_tonal.txt") #tonal
words = reader.words("bamadaba_non_tonal.txt")#tonal
pos = reader.words("bamadaba_non_tonal.txt", key="ps")#tonal
own_model = get_alt_pos(entries, pos, reader, option_tone)#tonal
print("Dictionary created")
dic = UnigramTagger(model=own_model, backoff=backoff)
return dic