nltk function

来源:互联网 发布:编程软件图标 编辑:程序博客网 时间:2024/05/22 15:43

1.Getting started with NLTK(PYTHON)

import nltk

nltk.download()

2. Searching Text

text.concordance("a")     word to be searched

text.similar("a")     words used in the similar context

text.common_contexts(["a","b"])       examine the context shared by two or more words

text.dispersion_plot(["a","b","c"])      plot word density

text.generate()          generate random text based on text data

3. Counting Vocabulary

len(text)       number of word in a text

set(text)        number of word type

text.count         frequency of word


0 0
原创粉丝点击