2019-06-24
阅读量:
411
WordNet处理工具
WordNet是一个庞大的英语词汇数据库。名词,动词,形容词和副词被分组为认知同义词集(同义词集),每个表达一个不同的概念。同义词通过概念 - 语义和词汇关系相互关联。
WordNet的结构使其成为计算语言学和自然语言处理的有用工具。
WordNet表面上类似于词库,因为它根据词的含义将词汇组合在一起。但是,有一些重要的区别。
- 首先,WordNet不仅仅是单词形式 - 字母串 - 而是单词的特定意义。结果,在网络中彼此非常接近的单词在语义上被消除歧义。
- 其次,WordNet标记了单词之间的语义关系,而同义词库中单词的分组并不遵循除意义相似性之外的任何显式模式。
# First, you're going to need to import wordnet:
from nltk.corpus import wordnet
# Then, we're going to use the term "program" to find synsets like so:
syns = wordnet.synsets("program")
# An example of a synset:
print(syns[0].name())
# Just the word:
print(syns[0].lemmas()[0].name())
# Definition of that first synset:
print(syns[0].definition())
# Examples of the word in use in sentences:
print(syns[0].examples())






评论(0)


暂无数据
推荐帖子
0条评论
0条评论
0条评论