1

I think this question was asked earlier but removed for reasons unknown. I am very new to DBPedia and have little knowledge about writing quesries. The problem I am trying to resolve is a Natural Language Problem. I am able to extract entities from a given sentence. I am able to classify some of them as Name, Organization and Person but unable to classify the rest correctly. So I wanted to add a lookup option where I look them up in a database like DPpedia for a classification. Just yesterday a kind soul suggested I look at DBPedia Spotlight. I went throught heir documentation. The best way to integrate it in my java code is :

import org.dbpedia.spotlight.annotate.DefaultParagraphAnnotator
import org.dbpedia.spotlight.disambiguate.{TwoStepDisambiguator, ParagraphDisambiguatorJ}
import org.dbpedia.spotlight.model.SpotlightConfiguration
import org.dbpedia.spotlight.model.SpotlightFactory
  val text = new String("Brazilian oil giant Petrobras and U.S. oilfield service company Halliburton have signed a technological cooperation agreement, Petrobras announced Monday. The two companies agreed on three projects: studies on contamination of fluids in oil wells, laboratory simulation of well production, and research on solidification of salt and carbon dioxide formations, said Petrobras. Twelve other projects are still under negotiation.")
  val configuration = new SpotlightConfiguration("conf/server.properties")
  val factory = new SpotlightFactory(configuration)
  val disambiguator = new ParagraphDisambiguatorJ(new TwoStepDisambiguator(factory.candidateSearcher, factory.contextSearcher))
  val spotter = factory.spotter()
  val annotator = new DefaultParagraphAnnotator(spotter, disambiguator);
  println(annotator.annotate(text))

However, I do not want to annotate paragraphs. Just run the annotation on words I extract from a sentence that could be possible entities e.g. in the sentence "Yahoo ceo Marissa Mayers said in a press conference yesterday...." I am able to extract Yahoo and Marissa Mayers. Now I want to use DBPedia to assign a classification to them.

Any help would be greatly appreciated.

serendipity
  • 852
  • 13
  • 32

0 Answers0