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

人物关系问答 app.py 调用get_target_array() 为什么参数传递不过去 报错就是下面这种 #20

Open
gengen-yuhuai opened this issue Mar 8, 2022 · 15 comments

Comments

@gengen-yuhuai
Copy link

Segmentor: Model not loaded!
Postagger: Model not loaded!
127.0.0.1 - - [08/Mar/2022 15:33:35] "GET /KGQA_answer?name=贾宝玉的父亲 HTTP/1.1" 500 -
Traceback (most recent call last):
File "D:\20220307\env\lib\site-packages\flask\app.py", line 2091, in call
return self.wsgi_app(environ, start_response)
File "D:\20220307\env\lib\site-packages\flask\app.py", line 2076, in wsgi_app
response = self.handle_exception(e)
File "D:\20220307\env\lib\site-packages\flask\app.py", line 2073, in wsgi_app
response = self.full_dispatch_request()
File "D:\20220307\env\lib\site-packages\flask\app.py", line 1518, in full_dispatch_request
rv = self.handle_user_exception(e)
File "D:\20220307\env\lib\site-packages\flask\app.py", line 1516, in full_dispatch_request
rv = self.dispatch_request()
File "D:\20220307\env\lib\site-packages\flask\app.py", line 1502, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
File "D:\20220307\project\1.0\KGQA_HLM-master\app.py", line 36, in KGQA_answer
res =ltp.get_target_array(res)
File "D:\20220307\project\1.0\KGQA_HLM-master\KGQA\ltp.py", line 41, in get_target_array
target_array.append(seg_array[1])
IndexError: list index out of range

@xiehou-design
Copy link

ltp.py里面的模型路径没改好

@gengen-yuhuai
Copy link
Author

已经改好了 确实是路径的问题

@linmumu0205
Copy link

你好 请问抽取小说中的人物关系relationship如何实现的呢 有相关代码吗

@xiehou-design
Copy link

那个relation.txt估计是哪里的公开数据集或者人工标注的吧,一般那个relation可以用实体关系抽取模型来做到,不过要标注数据,如果有公开数据集就比较简单了,直接先命名实体识别在关系抽取就会形成”实体-关系-实体“三元组,也就是那个relation.txt的一行5个值

@linmumu0205
Copy link

那个relation.txt估计是哪里的公开数据集或者人工标注的吧,一般那个relation可以用实体关系抽取模型来做到,不过要标注数据,如果有公开数据集就比较简单了,直接先命名实体识别在关系抽取就会形成”实体-关系-实体“三元组,也就是那个relation.txt的一行5个值

感谢提供思路

@lililijx
Copy link

lililijx commented Apr 2, 2023

已经改好了 确实是路径的问题

您好 请问具体是哪里呢 方便告知一下吗 我改了ltp.py里面的路径 好像还是不行

@gengen-yuhuai
Copy link
Author

gengen-yuhuai commented Apr 2, 2023 via email

@lililijx
Copy link

lililijx commented Apr 2, 2023

抱歉再次打扰,改了之后还是不太行 可以问问您的ltp是什么版本吗,谢谢

@gengen-yuhuai
Copy link
Author

gengen-yuhuai commented Apr 2, 2023 via email

@lililijx
Copy link

lililijx commented Apr 2, 2023

确实放在同级目录下了,但是还是不太行。我的版本也是3.4.0 ,但是pyltp是0.4.0

@gengen-yuhuai
Copy link
Author

gengen-yuhuai commented Apr 2, 2023 via email

@lililijx
Copy link

lililijx commented Apr 2, 2023

那请问您python用的什么版本呢,我用的3.8 所以没找到0.2.1的版本

@gengen-yuhuai
Copy link
Author

gengen-yuhuai commented Apr 2, 2023 via email

@lililijx
Copy link

lililijx commented Apr 2, 2023

好吧 谢谢您回答我这么多问题 十分感谢 我会换0.2.1试试的!

@gengen-yuhuai
Copy link
Author

gengen-yuhuai commented Apr 2, 2023 via email

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

4 participants