nltk pos_tag usage

后端 未结 3 1903
闹比i
闹比i 2021-01-12 04:41

I am trying to use speech tagging in NLTK and have used this command:

>>> text = nltk.word_tokenize(\"And now for something completely different\")
         


        
3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-12 05:34

    Your Python installation is not able to reach maxent or treemap.

    First, check if the tagger is indeed there: Start Python from the command line.

    >>> import nltk

    Then you can check using

    >>> dir (nltk)

    Look through the list to see if maxent and treebank are both there.

    Easier would be to type

    >>> "maxent" in dir(nltk)
    >>> True
    >>> "treebank" in dir(nltk)
    >>> True
    

    Use nltk.download() --> Models tab and check to see if the treemap tagger shows as installed. You should also try downloading the tagger again.

    NLTK Downloader, Models Tab

提交回复
热议问题