import it.uniroma1.lcl.babelfy.Babelfy;
import it.uniroma1.lcl.babelfy.Babelfy.AccessType;
import it.uniroma1.lcl.babelfy.Babelfy.Matching;
import it.uniroma1.lcl.babelfy.data.Annotation;
import it.uniroma1.lcl.babelfy.data.BabelSynsetAnchor;
import it.uniroma1.lcl.jlt.util.Language;
public class Example {
public static void main(String[] args) throws Exception {
Babelfy bfy = Babelfy.getInstance(AccessType.ONLINE);
Language lang = Language.EN;
String inputText = "A 58-year-old African-American woman presents to the ER with episodic pressing burning anterior chest pain that began two days earlier for the first time in her life.";
Annotation annotations = bfy.babelfy("", inputText, Matching.EXACT,
Language.EN);
System.out.println("Input text: " + inputText + "\nAnnotations:");
for (BabelSynsetAnchor annotation : annotations.getAnnotations()) {
System.out.println(annotation.getAnchorText() + "\t"
+ annotation.getBabelSynset().getId() + "\t"
+ annotation.getBabelSynset() + "\t"
+ annotation.getBabelSynset().getDBPediaURIs(lang));
}
}
}
The output :
Input text: "A 58-year-old African-American woman presents to the ER with episodic pressing burning anterior chest pain that began two days earlier for the first time in her life."
Annotations: