ubergrape / pyspotlight

A thin wrapper around the DBPedia Spotlight REST API
BSD 2-Clause "Simplified" License
58 stars 25 forks source link

Test with service http://spotlight.sztaki.hu:2222/rest/anotate does not work #10

Closed laparn closed 9 years ago

laparn commented 9 years ago

I am on python 3.4.3 and I just loaded spotlight. In order to test it, I try it

import spotlight annotations=spotlight.annotate('http://spotlight.sztaki.hu:2222/rest/annotate',"Obama is a tall man",confidence=0.4, support=20)

And I get an error :

Traceback (most recent call last): File "", line 1, in File "/home/arnaud/git/suma/spotlight/init.py", line 144, in annotate response.raise_for_status() File "/home/arnaud/git/suma/lib/python3.4/site-packages/requests/models.py", > line 851, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 400 Client Error: Bad Request

Does somebody have an idea of what is going on ?

originell commented 9 years ago

What version of DBpedia's spotlight are you using? It could be that they changed their API and this (rather old; last update 2013) wrapper was not updated.

robert-boulanger commented 9 years ago

Had the same Problem. sportlight.sztaki.hu doesn't like the LingPipeSpotter which is set by pyspotlight by default. you have to choose "Default" for spotter, then it works.

result = annotate(url,text=text,confidence= 0.5, support= 0,spotter='Default')

By the way, the next issue I had with this public server was, that if you want to try texts other then english you have to use different ports: Here is the list:

sztakiPorts= {"english" :  '2222', 
                      "german" :  '2226', 
                      "dutch" :   '2232', 
                      "hungarian" : '2229', 
                      "french" : '2225', 
                      "portuguese" : '2228', 
                      "italian" : '2230', 
                      "russian" : '2227', 
                      "turkish"  : '2235', 
                      "spanish" : '2231'}

hope this helps

sum1kawa commented 6 years ago

I think this problem occurs again.. If I run the following code,

import spotlight results = spotlight.annotate('http://spotlight.sztaki.hu:2222/rest/annotate', "World_War_II", confidence=0.4, support=20)

I get the below error:

requests.exceptions.ConnectionError: HTTPConnectionPool(host='spotlight.sztaki.hu', port=2222): Max retries exceeded with url: /rest/annotate (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x1108f3950>: Failed to establish a new connection: [Errno 60] Operation timed out',))

Does anyone know how to use dbpedia spotlight?

marvely commented 4 years ago

I am having the same issue as well. I tried to set spotter to default, and support to 0, but still got the timeout connection error message.

Is there another url I can use as host? Thanks.

My current code: HOST = 'http://spotlight.sztaki.hu:2222/rest/annotate' annotations = spotlight.annotate(HOST, text, confidence= 0.4, support= 0, spotter='Default')

originell commented 4 years ago

hey @marvely, I'm afraid I don't know of any other public spotlight instances :(

JiahuiSophieHU commented 3 years ago

I am having the same problem with the recommanded set ups: annotations = spotlight.annotate('http://spotlight.sztaki.hu:2222/rest/annotate',text,confidence=0.4, support=20, spotter='Default')

ConnectionError: HTTPConnectionPool(host='spotlight.sztaki.hu', port=2222): Max retries exceeded with url: /rest/annotate (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f4fca02b7b8>: Failed to establish a new connection: [Errno 110] Connection timed out',))