POS tagging - NLTK thinks noun is adjective

后端 未结 5 1790
执笔经年
执笔经年 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:47

    I am not sure what is the workaround but you can check the source here https://nltk.googlecode.com/svn/trunk/nltk/nltk/tag/

    Meanwhile I tried your sentence with little different approach.

    >>> s = "a woman needs a man. A fish needs a bicycle"
    >>> nltk.pos_tag(s.split())
    [('a', 'DT'), ('woman', 'NN'), ('needs', 'VBZ'), ('a', 'DT'), ('man.', NP'), ('A','NNP'),   ('fish', 'NN'), ('needs', 'VBZ'), ('a', 'DT'), ('bicycle', 'NN')]
    

    which resulted in fish as "NN".

提交回复
热议问题