简体   繁体   中英

Import Error when trying to import NLTK module

I am trying to implement a constituency parser from the below website.
https://bbengfort.github.io/snippets/2018/06/22/corenlp-nltk-parses.html

from nltk.parse.corenlpnltk.pa import CoreNLPParser

When I am trying the above step, I get this error.

Traceback (most recent call last): File "3main.py", line 2, in <module> from nltk.parse.corenlpnltk.pa import CoreNLPParser ImportError: No module named corenlpnltk.pa

Wrong import.

Use this:

from nltk.parse.corenlp import CoreNLPParser

Ref: https://www.nltk.org/_modules/nltk/parse/corenlp.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM