加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Python > 正文

Python NLTK中的形容词名词化

发布时间:2020-12-16 22:20:56 所属栏目:Python 来源:网络整理
导读:有没有办法使用NLTK获得Wordnet形容词标称化? 例如,对于“快乐”,期望的输出将是“快乐”. 我试图四处搜寻,但找不到任何东西. 谢谢! 最佳答案 快速而肮脏的答案是wordnet does this already: a happy smile; spent many happy days on the beach; a happy

有没有办法使用NLTK获得Wordnet形容词标称化?
例如,对于“快乐”,期望的输出将是“快乐”.

我试图四处搜寻,但找不到任何东西.

谢谢!

最佳答案
快速而肮脏的答案是wordnet does this already:

  • “a happy smile”; “spent many happy
    days on the beach”; “a happy marriage”

    • attribute
      • well-being characterized by emotions
        ranging from contentment to intense
        joy)
      • in a state of well-being)
    • derivationally related form
      • of well-being characterized by
        emotions ranging from contentment to
        intense joy)
      • (emotions experienced when in a state
        of well-being)

剩下的问题是如何以编程方式执行此操作(无需网络抓取).

添加:

wordnet库包装器工具非常强大,它展示了C库接口的广度:

$wn happy
No information available for noun happy
No information available for verb happy
Information available for adj happy
    -antsa      Antonyms
    -synsa      Synonyms (ordered by estimated frequency)
    -attra      Attributes
    -deria      Derived Forms
    -famla      Familiarity & Polysemy Count
    -grepa      List of Compound Words
    -over       Overview of Senses
$wn happy -deria -n1
Derived Forms of adj happy
Sense 1
happy (vs. unhappy)
       RELATED TO->(noun) happiness#1
           => happiness,felicity
       RELATED TO->(noun) happiness#2
           => happiness

所以,从Python的角度来说,你可以对wn命令进行子处理,这有点邋or,或者使用已经内置到NLTK中的wordnet工具.

在ubuntu(可能是debian)上,wordnet库和工具可以方便地使用:

sudo apt-get install wordnet wordnet-dev

唉:

$wn pythonic
No information available for pythonic

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读