使用pyspotlight工具

时间:2017-11-01 15:25:35

标签: spotlight-dbpedia

我正在尝试使用pyspotlight.suppose从文本中找到资源名称,文本是“Barack Obama很高”,然后程序应该将Barack Obama作为dbpedia资源返回。但程序显示“equests.exceptions.HTTPError:404客户端错误:找不到网址:https://github.com/dbpedia-spotlight/dbpedia-spotlightrest/“错误。如何解决。

导入聚光灯

annotations = spotlight.annotate('http://spotlight.dbpedia.org/rest/','Barack Obama很高',置信度= 0.4,支持率= 20)

打印(注释)

文件“word.py”,第2行,in     annotations = spotlight.annotate('http://spotlight.dbpedia.org/rest/','Barack Obama很高',置信度= 0.4,支持率= 20)

文件“/home/junlplab/.local/lib/python2.7/site-packages/spotlight/init.py”,第189行,注释

pydict = _post_request(address, payload, filters, headers)

文件“/home/junlplab/.local/lib/python2.7/site-packages/spotlight/init.py”,第51行,_post_request

response.raise_for_status()

文件“/home/junlplab/.local/lib/python2.7/site-packages/requests/models.py”,第937行,在raise_for_status中     提出HTTPError(http_error_msg,response = self)

requests.exceptions.HTTPError:404客户端错误:找不到网址:https://github.com/dbpedia-spotlight/dbpedia-spotlightrest/

1 个答案:

答案 0 :(得分:0)

降低信心和支持可能会给出所要求的答案, 试试这个:

annotations = spotlight.annotate('http://spotlight.dbpedia.org/rest/','Barack Obama is tall',confidence=0.0, support=0)