dbpedia-spotlight/dbpedia-spotlight-model

How to link resource to the corresponding text fragment in the original input text from json response

fanavarro opened this issue · 0 comments

Hi, I am wondering how to relate detected resources with the input text. For example, for the input:
"The Battle of Gettysburg was fought July 1–3, 1863."
I used the following curl command to query a local instance of spotlight:

curl -X POST http://localhost:2222/rest/annotate -H 'accept: application/json' -H 'content-type: application/x-www-form-urlencoded' --data-urlencode "text=The Battle of Gettysburg was fought July 1–3, 1863." --data-urlencode "confidence=0.35"

Which returns the following:

{
   "@text":"The Battle of Gettysburg was fought July 1–3, 1863.",
   "@confidence":"0.35",
   "@support":"0",
   "@types":"",
   "@sparql":"",
   "@policy":"whitelist",
   "Resources":[
      {
         "@URI":"http://dbpedia.org/resource/Battle_of_Gettysburg",
         "@support":"2871",
         "@types":"Wikidata:Q1656682,DUL:Event,Schema:Event,DBpedia:SocietalEvent,DBpedia:MilitaryConflict,DBpedia:Event",
         "@surfaceForm":"Gettysburg",
         "@offset":"14",
         "@similarityScore":"0.9856069793346309",
         "@percentageOfSecondRank":"0.014354886850971043"
      }
   ]
}

From this response, how can I know that the URI http://dbpedia.org/resource/Battle_of_Gettysburg comes from the text "The Battle of Gettysburg"? I was using the surface form, but this field only indicates "Gettysburg". Also, the offset field indicates the start position of "Gettysburg". Could this be a bug?

I've tried to use the demo webpage (https://www.dbpedia-spotlight.org/demo/) in order to check if only "Gettysburg" is hightlighed, but it seems to be down at this moment.

Thanks beforehand.