热线电话:13121318867

登录
2019-03-18 阅读量: 890
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())

输出:

[‘they drew up a six-step plan’, ‘they discussed plans for a new bond issue’]

0.0000
6
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子