List of usage examples for opennlp.tools.namefind NameFinderME probs
public double[] probs(Span[] spans)
From source file:org.sglover.nlp.CoreNLPEntityTagger.java
private void findEntities(Entities namedEntities, List<TextAnnotation> allTextAnnotations, String[] tokens) { for (Map.Entry<String, TokenNameFinderModel> finderEntry : tokenNameFinders.entrySet()) { String type = finderEntry.getKey(); NameFinderME finder = new NameFinderME(finderEntry.getValue()); try {/*from w ww.j a v a2 s .c o m*/ Span[] spans = finder.find(tokens); double[] probs = finder.probs(spans); for (int ni = 0; ni < spans.length; ni++) { allTextAnnotations.add(new TextAnnotation(type, spans[ni], probs[ni])); } } finally { finder.clearAdaptiveData(); } } if (allTextAnnotations.size() > 0) { removeConflicts(allTextAnnotations); } convertTextAnnotationsToNamedEntities(tokens, allTextAnnotations, namedEntities); }