Package org.dbpedia.spotlight.annotate

Examples of org.dbpedia.spotlight.annotate.DefaultParagraphAnnotator


  private static void writeAnnotations(SpotlightFactory spotlightFactory, AnnotatedDataset evaluationCorpus,
                     File annotationsFolder) throws IOException {


    DefaultParagraphAnnotator annotator = null;
    //spotlightFactory.annotator(); --> HACK: DefaultAnnotator is not DefaultParagraphAnnotator

    int i = 0;
    for(Text text : evaluationCorpus.getTexts()){
      i++;
      if(new File(annotationsFolder, i + ".tsv").exists()) {
        continue;
      }

      try{
        List<DBpediaResourceOccurrence> annotatedOccurrences = annotator.annotate(text.text());

        FileWriter fileWriter = new FileWriter(new File(annotationsFolder, i + ".tsv"));
        for(DBpediaResourceOccurrence annotatedOccurrence : annotatedOccurrences){
          fileWriter.write(annotatedOccurrence.toTsvString() + "\n");
        }
View Full Code Here

TOP

Related Classes of org.dbpedia.spotlight.annotate.DefaultParagraphAnnotator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.