@Test public void testAnnotateType() throws IOException { Resource path = Resource.fromJAR("models"); MentionAnnotator annotatorEN = (MentionAnnotator) AnnotatorFactory.loadAnnotator(path.resolve("MentionAnnotator_en_NER-GENERIC_WikiNER+tri_20170309")); Document doc1 = DocumentFactory.fromText(textEN); annotatorEN.getTagger().setType("TEST"); annotatorEN.annotate(doc1); doc1.streamAnnotations(Annotation.Source.PRED, MentionAnnotation.class).forEach(ann -> { Assert.assertEquals("TEST", ann.getType()); }); }
@Override public void annotate(Collection<Document> docs) { Map<String, List<Document>> groups = docs.stream().collect(Collectors.groupingBy(doc -> Optional.ofNullable(doc.getLanguage()).orElse("unk"))); for(Map.Entry<String, List<Document>> group : groups.entrySet()) { if(group.getKey().equals("de")) { annotatorDE.annotate(group.getValue()); } else if(group.getKey().equals("en")) { annotatorEN.annotate(group.getValue()); } else { log.warn("Detected language " + group.getKey() + ", using English annotator."); annotatorEN.annotate(group.getValue()); } } }
GenericMentionAnnotator extends MentionAnnotator { @Override public void annotate(Collection<Document> docs) { Map<String, List<Document>> groups = docs.stream().collect(Collectors.groupingBy(doc -> Optional.ofNullable(doc.getLanguage()).orElse("unk"))); for(Map.Entry<String, List<Document>> group : groups.entrySet()) { if(group.getKey().equals("de")) { annotatorDE.annotate(group.getValue()); } else if(group.getKey().equals("en")) { annotatorEN.annotate(group.getValue()); } else { log.warn("Detected language " + group.getKey() + ", using English annotator."); annotatorEN.annotate(group.getValue()); } } } }
GenericMentionAnnotator extends MentionAnnotator { @Override public void annotate(Collection<Document> docs) { Map<String, List<Document>> groups = docs.stream().collect(Collectors.groupingBy(doc -> Optional.ofNullable(doc.getLanguage()).orElse("unk"))); for(Map.Entry<String, List<Document>> group : groups.entrySet()) { if(group.getKey().equals("de")) { annotatorDE.annotate(group.getValue()); } else if(group.getKey().equals("en")) { annotatorEN.annotate(group.getValue()); } else { log.warn("Detected language " + group.getKey() + ", using English annotator."); annotatorEN.annotate(group.getValue()); } } } protected  GenericMentionAnnotator(); }
GenericMentionAnnotator extends MentionAnnotator { @Override public void annotate(Collection<Document> docs) { Map<String, List<Document>> groups = docs.stream().collect(Collectors.groupingBy(doc -> Optional.ofNullable(doc.getLanguage()).orElse("unk"))); for(Map.Entry<String, List<Document>> group : groups.entrySet()) { if(group.getKey().equals("de")) { annotatorDE.annotate(group.getValue()); } else if(group.getKey().equals("en")) { annotatorEN.annotate(group.getValue()); } else { log.warn("Detected language " + group.getKey() + ", using English annotator."); annotatorEN.annotate(group.getValue()); } } } protected  GenericMentionAnnotator(); static MentionAnnotator create(); MentionAnnotator getEnglishMentionAnnotator(); MentionAnnotator getGermanMentionAnnotator(); @Override void annotate(Collection<Document> docs); }
GenericMentionAnnotator extends MentionAnnotator { @Override public void annotate(Collection<Document> docs) { Map<String, List<Document>> groups = docs.stream().collect(Collectors.groupingBy(doc -> Optional.ofNullable(doc.getLanguage()).orElse("unk"))); for(Map.Entry<String, List<Document>> group : groups.entrySet()) { if(group.getKey().equals("de")) { annotatorDE.annotate(group.getValue()); } else if(group.getKey().equals("en")) { annotatorEN.annotate(group.getValue()); } else { log.warn("Detected language " + group.getKey() + ", using English annotator."); annotatorEN.annotate(group.getValue()); } } } protected  GenericMentionAnnotator(); static MentionAnnotator create(); MentionAnnotator getEnglishMentionAnnotator(); MentionAnnotator getGermanMentionAnnotator(); @Override void annotate(Collection<Document> docs);  }