I'm facing a problem with dbpedia spotlight. I can't seem to connect to the local docker image found here .
I used the command docker pull dbpedia/spotlight-english
with docker run -i -p 2222:80 dbpedia/spotlight-english
and then checked that the container is running with docker ps
. Everything works fine.
After that, I try to query the server by running the curl given in the spotlight documentation :
curl http://0.0.0.0:2222/en/annotate \
--data-urlencode "text=President Obama called Wednesday on Congress to extend a tax break
for students included in last year's economic stimulus package, arguing
that the policy provides more generous assistance." \
--data "confidence=0.35"
And the same with the following URLs:
All I get is curl: (52) Empty reply from server
.
What am I not getting here? All help appreciated.
The correct is
curl -X POST \
http://localhost:2222/rest/annotate \
-H 'accept: application/json' \
-H 'content-type: application/x-www-form-urlencoded' \
--data-urlencode "text=President Obama called Wednesday on Congress to extend a tax break for students included in last year's economic stimulus package, arguing that the policy provides more generous assistance" \
--data-urlencode "confidence=0.35"
The empty reply error indicates that nothing was listening on your local port 2222. This is caused by the docker command docker run -i -p 2222:80 dbpedia/spotlight-english
, in which the Spotlight container's port 2222 is mapped to port 80 on the host machine.
With the correct request syntax, as @Sandro has shared, the example should work on a locally running docker container with the url http://localhost:80/rest/annotate
(or by omitting the port number altogether, given that 80 is the default).
To run the docker image of English version:
docker run -i -p 2222: 80 dbpedia / spotlight-english spotlight.sh
Open the localhost and give the text in the below format: localhost: 2222 / rest / annotate? Text = TextYouWantToAnnotate & confidence = 0.2 & support = 20
Example:
localhost:2222/rest/annotate?text=When I was growing up, my zealously frugal parents refused to buy anything from a bookstore, insisting that the local library had whatever it was we could possibly want to read. Faced with a small child's intensive lobbying for repeated storytelling sessions with a lavishly illustrated picture book, my father would borrow one from the library and photocopy it. I still remember how anything colorful on the page (ie everything) would get transformed into dark blobs, the toner blurring the text and smudging my fingers.&confidence=0.2&support=20
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.