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

请教一下,问答界面会报错,搜索界面也搜不到想要的目标 #25

Open
J-Jzf opened this issue Apr 17, 2024 · 1 comment

Comments

@J-Jzf
Copy link

J-Jzf commented Apr 17, 2024

如题,
image
127.0.0.1 - - [17/Apr/2024 19:38:17] "GET /KGQA_answer?name=贾宝玉的爸爸是谁 HTTP/1.1" 500 -
Traceback (most recent call last):
File "D:\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\flask\app.py", line 1498, in call
return self.wsgi_app(environ, start_response)
File "D:\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\flask\app.py", line 1476, in wsgi_app
response = self.handle_exception(e)
File "D:\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\flask\app.py", line 1473, in wsgi_app
response = self.full_dispatch_request()
File "D:\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\flask\app.py", line 882, in full_dispatch_request
rv = self.handle_user_exception(e)
File "D:\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\flask\app.py", line 880, in full_dispatch_request
rv = self.dispatch_request()
File "D:\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\flask\app.py", line 865, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
File "d:\Microsoft VS Code\vs work\codeworkvs\py\py\dachuang\KGQA\KGQA_HLM-master\app.py", line 31, in KGQA_answer
json_data = get_KGQA_answer(get_target_array(str(question)))
File "d:\Microsoft VS Code\vs work\codeworkvs\py\py\dachuang\KGQA\KGQA_HLM-master\KGQA\ltp.py", line 33, in get_target_array
seg_array=cut_words(words)
File "d:\Microsoft VS Code\vs work\codeworkvs\py\py\dachuang\KGQA\KGQA_HLM-master\KGQA\ltp.py", line 8, in cut_words
segmentor = pyltp.Segmentor()
TypeError: init(): incompatible constructor arguments. The following argument types are supported:
1. pyltp.Segmentor(model_path: str, lexicon_path: str = None, force_lexicon_path: str = None)

Invoked with:

image
image

@fanyingmanliangpai
Copy link

如题, image 127.0.0.1 - - [17/Apr/2024 19:38:17] "GET /KGQA_answer?name=贾宝玉的爸爸是谁 HTTP/1.1" 500 - Traceback (most recent call last): File "D:\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\flask\app.py", line 1498, in call return self.wsgi_app(environ, start_response) File "D:\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\flask\app.py", line 1476, in wsgi_app response = self.handle_exception(e) File "D:\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\flask\app.py", line 1473, in wsgi_app response = self.full_dispatch_request() File "D:\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\flask\app.py", line 882, in full_dispatch_request rv = self.handle_user_exception(e) File "D:\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\flask\app.py", line 880, in full_dispatch_request rv = self.dispatch_request() File "D:\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\flask\app.py", line 865, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return] File "d:\Microsoft VS Code\vs work\codeworkvs\py\py\dachuang\KGQA\KGQA_HLM-master\app.py", line 31, in KGQA_answer json_data = get_KGQA_answer(get_target_array(str(question))) File "d:\Microsoft VS Code\vs work\codeworkvs\py\py\dachuang\KGQA\KGQA_HLM-master\KGQA\ltp.py", line 33, in get_target_array seg_array=cut_words(words) File "d:\Microsoft VS Code\vs work\codeworkvs\py\py\dachuang\KGQA\KGQA_HLM-master\KGQA\ltp.py", line 8, in cut_words segmentor = pyltp.Segmentor() TypeError: init(): incompatible constructor arguments. The following argument types are supported: 1. pyltp.Segmentor(model_path: str, lexicon_path: str = None, force_lexicon_path: str = None)

Invoked with:

image image

segmentor = pyltp.Segmentor(model_path=os.path.join(LTP_DATA_DIR, 'cws.model'))
用这行代码初始化实例,postagger也一样

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