Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: type object 'CharniakParser' has no attribute 'loadModel' #71

Open
liutaonuist opened this issue Nov 5, 2022 · 3 comments

Comments

@liutaonuist
Copy link

AttributeError: type object 'CharniakParser' has no attribute 'loadModel',
from . import CharniakParser as parser
from . import JohnsonReranker as reranker

@dmcc
Copy link
Member

dmcc commented Nov 5, 2022

Thanks for the report! Seems like BLLIP Parser might not have been installed correctly. Can you give more information on the issue? These would be helpful:

  1. Full traceback of the error
  2. More context on what code you were running which triggered the error
  3. How BLLIP Parser was installed and/or built (i.e., with pip, as a dependency of something else, etc.)
  4. Your OS/distribution

Also, can you add more detail on how this issue relates to your comment on dmcc@558adf6#commitcomment-88965788 ?

dmcc referenced this issue in dmcc/bllip-parser Nov 5, 2022
Changes needed for compiling with clang under OS X
@liutaonuist
Copy link
Author

1、Problem(1、Full traceback of the error)
Traceback (most recent call last):
File "amr_parsing.py", line 435, in
main()
File "amr_parsing.py", line 168, in main
instances = preprocess(amr_file,START_SNLP=True,INPUT_AMR=args.amrfmt, PRP_FORMAT=args.prpfmt)
File "/root/autodl-tmp/CLEVE-main/camr/preprocessing.py", line 504, in preprocess
dparser.parse(tok_sent_filename)
File "/root/autodl-tmp/CLEVE-main/camr/depparser.py", line 24, in parse
from bllipparser.ModelFetcher import download_and_install_model
File "/root/autodl-tmp/CLEVE-main/camr/bllipparser/init.py", line 400, in
from .RerankingParser import RerankingParser, Tree, Sentence, tokenize
File "/root/autodl-tmp/CLEVE-main/camr/bllipparser/RerankingParser.py", line 21, in
from . import CharniakParser as parser
ImportError: cannot import name CharniakParser
2、The problem appears in the RerankingParser.py,the head file in it is under followed.it cannot find CharniakParser in RerankingParser.py,note that the tips “Higher-level python frontend to the BLLIP reranking parser. Wraps the lower-level (SWIG-generated) CharniakParser and JohnsonReranker modules so you don't need to interact with them directly”,but the question is that when i want to use the CharniakParser,how can i call(import) it?
import sys
sys.path.append("..")
from os.path import exists, join
from six import string_types
from . import CharniakParser as parser
from . import JohnsonReranker as reranker
from .Utility import cleanup_input_token, normalize_logprobs

@dmcc
Copy link
Member

dmcc commented Nov 6, 2022

Thanks for the information! From your stack trace, it looks like you're running BLLIP Parser from CAMR which has a script to install BLLIP Parser.

Have you run that script? What happens when you run pip install --user bllipparser?

The answer to question 4 would be helpful for debugging (as you may also need to install things like swig and flex, the setup of which would depend on your OS/distribution).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants