POS tagging - NLTK thinks noun is adjective

后端 未结 5 1792
执笔经年
执笔经年 2020-12-19 11:56

In the following code, why does nltk think \'fish\' is an adjective and not a noun?

>>> import nltk
>>> s = \"a woman needs a man like a fi         


        
5条回答
  •  轮回少年
    2020-12-19 12:41

    If you use the Stanford POS tagger (3.5.1) then the phrase is correctly tagged:

    from nltk.tag.stanford import POSTagger
    st = POSTagger("/.../stanford-postagger-full-2015-01-30/models/english-left3words-distsim.tagger",
                   "/.../stanford-postagger-full-2015-01-30/stanford-postagger.jar")
    st.tag("a woman needs a man like a fish needs a bicycle".split())
    

    yields:

    [('a', 'DT'),
     ('woman', 'NN'),
     ('needs', 'VBZ'),
     ('a', 'DT'),
     ('man', 'NN'),
     ('like', 'IN'),
     ('a', 'DT'),
     ('fish', 'NN'),
     ('needs', 'VBZ'),
     ('a', 'DT'),
     ('bicycle', 'NN')]
    

提交回复
热议问题