/** * Copies the elements of the parsed iterator to a list. * @param iterator the iterator * @return the List with all spans of the Iterators */ public static <T extends Span> List<T> asList(Iterator<T> it){ if(it == null || !it.hasNext()){ return Collections.emptyList(); } else { List<T> spans = new ArrayList<T>(); appandToList(it, spans); return spans; } } /**
/** * Copies the elements of the parsed iterator(s) to a {@link SortedSet}. As * {@link Span} implements {@link Comparable} the Spans within the resulting * set will have the same order as returned by the methods of {@link AnalysedText} * @param it the iterator(s) * @return the {@link SortedSet} containing all Spans of the iterators */ public static <T extends Span> SortedSet<T> asSet(Iterator<T> it){ SortedSet<T> spans = new TreeSet<T>(); addToSet(it, spans); return spans; } /**
AnalysedText at; try { at = AnalysedTextUtils.getAnalysedText(ci); }catch (RuntimeException e) { log.warn("Unable to retrieve AnalysedText for ContentItem "
AnalysedText at; try { at = AnalysedTextUtils.getAnalysedText(ci); }catch (RuntimeException e) { log.warn("Unable to retrieve AnalysedText for ContentItem "
AnalysedTextFactory analysedTextFactory, ContentItem ci) throws EngineException { AnalysedText at = AnalysedTextUtils.getAnalysedText(ci); if(at == null){ if(analysedTextFactory == null){ at = AnalysedTextUtils.getAnalysedText(ci); if(at == null){ log.debug(" ... create new AnalysedText instance for Engine {}", engine.getName());
/** * Copies the elements of the parsed iterator to a list. * @param iterator the iterator * @return the List with all spans of the Iterators */ public static <T extends Span> List<T> asList(Iterator<T> it){ if(it == null || !it.hasNext()){ return Collections.emptyList(); } else { List<T> spans = new ArrayList<T>(); appandToList(it, spans); return spans; } } /**
/** * Copies the elements of the parsed iterator(s) to a {@link SortedSet}. As * {@link Span} implements {@link Comparable} the Spans within the resulting * set will have the same order as returned by the methods of {@link AnalysedText} * @param it the iterator(s) * @return the {@link SortedSet} containing all Spans of the iterators */ public static <T extends Span> SortedSet<T> asSet(Iterator<T> it){ SortedSet<T> spans = new TreeSet<T>(); addToSet(it, spans); return spans; } /**
AnalysedTextFactory analysedTextFactory, ContentItem ci) throws EngineException { AnalysedText at = AnalysedTextUtils.getAnalysedText(ci); if(at == null){ if(analysedTextFactory == null){ at = AnalysedTextUtils.getAnalysedText(ci); if(at == null){ log.debug(" ... create new AnalysedText instance for Engine {}", engine.getName());
log.trace(" > use existing Sentence annotations for {}",at); sentenceList = new ArrayList<Section>(); AnalysedTextUtils.appandToList(sentences, sentenceList); } else { log.trace(" > use existing Tokens for {}",sentence); tokenList = new ArrayList<Token>(); //ensure an ArrayList is used AnalysedTextUtils.appandToList(tokens, tokenList);
AnalysedText at = AnalysedTextUtils.getAnalysedText(ci); if(at == null){ if( linkingMode == LinkingModeEnum.PLAIN){
List<Section> sentences = new ArrayList<Section>(); AnalysedTextUtils.appandToList(at.getSentences(), sentences); if(sentences.isEmpty()){ //no sentence annotations
+ "EnhancementJobManager!"); final AnalysedText at = AnalysedTextUtils.getAnalysedText(ci);
} else { //AnalysedText is optional in LinkingModeEnum.BASIC try { at = AnalysedTextUtils.getAnalysedText(ci); } catch (ClassCastException e) {