Good day, stackoverflow,
I need to suggest to user different contexts for a word, so that he could have a possibility to disambuguate it.
For example: a word "less" can be Unix program, css framework or some other things. A word "apple" can be a fruit, a corporation, a river, a state in the US (big apple) or a bunch of other things.
I hope you got the idea.
I looked over the internet and so far I could come up only with this query.
But it's still far from being perfect. It often gives too much or too few words and sometimes nothing (for "jquery").
http://www.visualdataweb.org/relfinder/relfinder.php seems to use dbpedia as well, but its results are far better than mine.
How should I change my query to get more relevant results?
If you are looking for a Web API, use: DBpedia Lookup or DBpedia Spotlight. If you need to do it in SPARQL, you can use the DBpedia Lexicalization Dataset.
For DBpedia Lookup, you can give a string and retrieve DBpedia Resources with labels matching those strings: lookup.dbpedia.org/api/search.asmx/KeywordSearch?QueryString=apple
For DBpedia Spotlight, you can optionally give more context: spotlight.dbpedia.org/rest/candidates?text=apple+company+macintosh+computer
For the Lexicalization Dataset, there is no SPARQL endpoint available yet. You will need to download it, load it in your own RDF store and run a query like this:
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
SELECT ?resource ?score WHERE {
GRAPH ?g {
?resource skos:altLabel ?label.
}
?g <http://dbpedia.org/spotlight/score> ?score.
FILTER (REGEX(?label, "apple", "i"))
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With