@Override protected <T extends Annotation> List<T> select( JCas jCas, Annotation focusAnnotation, Class<T> annotationClass, int count) { return JCasUtil.selectFollowing(jCas, annotationClass, focusAnnotation, count); } }
public static int getNextSentenceAddress(JCas aJcas, Sentence aSentence) { try { return WebAnnoCasUtil.getAddr(selectFollowing(Sentence.class, aSentence, 1).get(0)); } catch (Exception e) { // end of the document reached return WebAnnoCasUtil.getAddr(aSentence); } }
public static int getNextSentenceAddress(JCas aJcas, Sentence aSentence) { try { return WebAnnoCasUtil.getAddr(selectFollowing(Sentence.class, aSentence, 1).get(0)); } catch (Exception e) { // end of the document reached return WebAnnoCasUtil.getAddr(aSentence); } }
/** * Get the sentence address of the next sentence * * @param aJcas * The CAS object * @param aRef * The address of the current sentence * @return address of the next sentence */ public static int getFollowingSentenceAddress(JCas aJcas, int aRef) { Sentence sentence = selectByAddr(aJcas, Sentence.class, aRef); List<Sentence> followingSentence = selectFollowing(aJcas, Sentence.class, sentence, 1); if (followingSentence.size() > 0) { return followingSentence.get(0).getAddress(); } else { return aRef; } }
public static Token getNextToken(JCas aJCas, int aBegin, int aEnd) { AnnotationFS currentToken = selectSingleAt(aJCas, Token.class, aBegin, aEnd); // thid happens when tokens such as Dr. OR Ms. selected with double // click, which make seletected text as Dr OR Ms if (currentToken == null) { currentToken = selectSingleAt(aJCas, Token.class, aBegin, aEnd + 1); } Token nextToken = null; for (Token token : selectFollowing(Token.class, currentToken, 1)) { nextToken = token; } return nextToken; }
public static Token getNextToken(JCas aJCas, int aBegin, int aEnd) { AnnotationFS currentToken = selectSingleAt(aJCas, Token.class, aBegin, aEnd); // thid happens when tokens such as Dr. OR Ms. selected with double // click, which make seletected text as Dr OR Ms if (currentToken == null) { currentToken = selectSingleAt(aJCas, Token.class, aBegin, aEnd + 1); } Token nextToken = null; for (Token token : selectFollowing(Token.class, currentToken, 1)) { nextToken = token; } return nextToken; }
private static String getTriple(JCas jcas, Chunk vc) { List<NC> ncListLeft = JCasUtil.selectPreceding(jcas, NC.class, vc, 1); List<NC> ncListRight = JCasUtil.selectFollowing(jcas, NC.class, vc, 1); String ncStringLeft = getChunkString(jcas, ncListLeft); String ncStringRight = getChunkString(jcas, ncListRight); String vcString = getChunkString(jcas, Arrays.asList(vc)); String tripleString; if (ncStringLeft.length() > 0 && ncStringRight.length() > 0) { // tripleString = ncStringLeft + "-" + ncStringRight; tripleString = ncStringLeft + "-" + vcString + "-" + ncStringRight; } else { tripleString = ""; } return tripleString; }
private static String getTriple(JCas jcas, Chunk vc) { List<NC> ncListLeft = JCasUtil.selectPreceding(jcas, NC.class, vc, 1); List<NC> ncListRight = JCasUtil.selectFollowing(jcas, NC.class, vc, 1); String ncStringLeft = getChunkString(jcas, ncListLeft); String ncStringRight = getChunkString(jcas, ncListRight); String vcString = getChunkString(jcas, Arrays.asList(vc)); String tripleString; if (ncStringLeft.length() > 0 && ncStringRight.length() > 0) { // tripleString = ncStringLeft + "-" + ncStringRight; tripleString = ncStringLeft + "-" + vcString + "-" + ncStringRight; } else { tripleString = ""; } return tripleString; }
classificationUnit, j); List<Token> followingTokens = JCasUtil.selectFollowing(jcas, Token.class, classificationUnit, j);
@Override public void process(JCas jcas) throws AnalysisEngineProcessException { Collection<Token> words = JCasUtil.select(jcas, Token.class); Iterator<Token> iterator = words.iterator(); if (iterator.hasNext()) { for (Token start = iterator.next(); iterator.hasNext(); start = iterator .next()) { if (start.getCoveredText().toLowerCase().startsWith(ANTI)) { List<Token> wordlist = JCasUtil.selectFollowing(Token.class, start, 1); Token end = wordlist.get(wordlist.size() - 1); if (end.getCoveredText().toLowerCase().startsWith(MAB)) { AntiBody antiBody = new AntiBody(jcas); antiBody.setBegin(start.getBegin()); antiBody.setEnd(end.getEnd()); antiBody.setAnnotationId(AnnotationCounter.getUniqueId()); antiBody.addToIndexes(); } } } } } }
start = annotation.getEnd(); end = documentText.length(); List<TOKEN_TYPE> anns = JCasUtil.selectFollowing(jCas, tokenClass, annotation, numberOfTokens); if (anns.size() > 0) { end = anns.get(anns.size() - 1).getEnd();
start = annotation.getEnd(); end = documentText.length(); List<TOKEN_TYPE> anns = JCasUtil.selectFollowing(jCas, tokenClass, annotation, numberOfTokens); if (anns.size() > 0) { end = anns.get(anns.size() - 1).getEnd();
map.put(s1, true); for (Annotation s2 : JCasUtil.selectFollowing(contextClass, s, rightContextSize)) { getLogger().debug("Contexting sentence " + s2); map.put(s2, true);
Lemma nextLemma; for (int i = 1; i < entry.length; i++) { nextLemma = JCasUtil.selectFollowing(Lemma.class, lemma, 1).get(0); if (nextLemma.getValue().equalsIgnoreCase(entry[i].toLowerCase())) { end = nextLemma.getEnd();
break; List<Sentence> precedingSentences = selectFollowing(aJcas, Sentence.class, sentence, 1); if (precedingSentences.size() > 0) { i = precedingSentences.get(0).getAddress();
final Collection<Token> tokens = JCasUtil.selectFollowing(Token.class, ref, 1); final Iterator<Token> it = tokens.iterator(); if (it.hasNext()) { switch (ts) { case "(": closeTokens = JCasUtil.selectFollowing(Token.class, position, MAX_ABBRV_TOKEN_COUNT + 1); break;
final Collection<Number> numbers = JCasUtil.select(jcas, Number.class); for (Number n : numbers) { List<Number> followNumber = JCasUtil.selectFollowing(jcas, Number.class, n, 2); for (Number fol : followNumber) {
final Collection<VertebralPosition> positions = JCasUtil.select(jcas, VertebralPosition.class); for (VertebralPosition n : positions) { List<VertebralPosition> followNumber = JCasUtil.selectFollowing(jcas, VertebralPosition.class, n, 2); for (VertebralPosition fol : followNumber) {
private void commonUpdate() throws IOException { JCas jCas = curationDocumentService.readCurationCas(state.getDocument()); // Determine the FIRST visible unit final Sentence firstVisibleUnit = selectSentenceAt(jCas, state.getFirstVisibleUnitBegin(), state.getFirstVisibleUnitEnd()); state.setFirstVisibleUnit(firstVisibleUnit); // Determine the LAST visible unit List<Sentence> followingUnits = selectFollowing(jCas, Sentence.class, firstVisibleUnit, state.getPreferences().getWindowSize()); // Check also, when getting the last sentence address in the display window, if this is the // last sentence or the ONLY sentence in the document Sentence lastVisibleUnit = followingUnits.size() == 0 ? firstVisibleUnit : followingUnits.get(followingUnits.size() - 1); curationView.setCurationBegin(firstVisibleUnit.getBegin()); curationView.setCurationEnd(lastVisibleUnit.getEnd()); // Determine the number of the first and last visible unit int ws = state.getPreferences().getWindowSize(); Sentence fs = WebAnnoCasUtil.selectSentenceAt(jCas, state.getFirstVisibleUnitBegin(), state.getFirstVisibleUnitEnd()); Sentence ls = WebAnnoCasUtil.getLastSentenceInDisplayWindow(jCas, getAddr(fs), ws); fSn = WebAnnoCasUtil.getSentenceNumber(jCas, fs.getBegin()); lSn = WebAnnoCasUtil.getSentenceNumber(jCas, ls.getBegin()); }
private void commonUpdate() throws IOException { JCas jCas = curationDocumentService.readCurationCas(state.getDocument()); // Determine the FIRST visible unit final Sentence firstVisibleUnit = selectSentenceAt(jCas, state.getFirstVisibleUnitBegin(), state.getFirstVisibleUnitEnd()); state.setFirstVisibleUnit(firstVisibleUnit); // Determine the LAST visible unit List<Sentence> followingUnits = selectFollowing(jCas, Sentence.class, firstVisibleUnit, state.getPreferences().getWindowSize()); // Check also, when getting the last sentence address in the display window, if this is the // last sentence or the ONLY sentence in the document Sentence lastVisibleUnit = followingUnits.size() == 0 ? firstVisibleUnit : followingUnits.get(followingUnits.size() - 1); curationView.setCurationBegin(firstVisibleUnit.getBegin()); curationView.setCurationEnd(lastVisibleUnit.getEnd()); // Determine the number of the first and last visible unit int ws = state.getPreferences().getWindowSize(); Sentence fs = WebAnnoCasUtil.selectSentenceAt(jCas, state.getFirstVisibleUnitBegin(), state.getFirstVisibleUnitEnd()); Sentence ls = WebAnnoCasUtil.getLastSentenceInDisplayWindow(jCas, getAddr(fs), ws); fSn = WebAnnoCasUtil.getSentenceNumber(jCas, fs.getBegin()); lSn = WebAnnoCasUtil.getSentenceNumber(jCas, ls.getBegin()); }