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

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

Open
fanavarro opened this issue Aug 28, 2020 · 0 comments

Comments

@fanavarro
Copy link

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.

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

1 participant