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

'pyltp.Postagger' object has no attribute 'load' 问题 #16

Open
Yuning-J opened this issue Dec 3, 2022 · 1 comment
Open

'pyltp.Postagger' object has no attribute 'load' 问题 #16

Yuning-J opened this issue Dec 3, 2022 · 1 comment

Comments

@Yuning-J
Copy link

Yuning-J commented Dec 3, 2022

您好!感谢分享!我在运行的时候出现了以下问题(已经load model了):
Start extracting...
Building prefix dict from the default dictionary ...
Loading model from cache /var/folders/_t/9brcc8tj3jbd5v9455w8bzh80000gp/T/jieba.cache
Loading model cost 0.989 seconds.
Prefix dict has been built successfully.
Traceback (most recent call last):
File "extract_demo.py", line 19, in
nlp = NLP()
File "../core/nlp.py", line 49, in init
postag_flag = self.postagger.load(os.path.join(self.default_model_dir, 'pos.model'))
AttributeError: 'pyltp.Postagger' object has no attribute 'load'

请问您有什么建议吗?谢谢

@DeoooChen
Copy link

如果用的是pyltp0.4.0的话,是没有.load(model_path=path)这个方法的。现在改成了在初始化中就定义模型路径,例如:self.recognizer = NamedEntityRecognizer(os.path.join(self.default_model_dir, 'ner.model'))。在./code/core/nlp.py里面修改一下这几处代码即可

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