if(n.getBegin()<=wt.getBegin() && n.getEnd()>=wt.getEnd()) { isNE = true; break;
if(n.getBegin()<=wt.getBegin() && n.getEnd()>=wt.getEnd()) { isNE = true; break;
/** * A utility method that annotates a given range. */ protected void annotateRange(JCas jcas, String text, int rangeBegin, int rangeEnd) throws AnalysisEngineProcessException { JFSIndexRepository indexes = jcas.getJFSIndexRepository(); Iterator<?> wordItr = indexes.getAnnotationIndex(WordToken.type) .iterator(); while (wordItr.hasNext()) { WordToken wordAnnotation = (WordToken) wordItr.next(); if (wordAnnotation.getBegin() >= rangeBegin && wordAnnotation.getEnd() <= rangeEnd) { String word = text.substring(wordAnnotation.getBegin(), wordAnnotation.getEnd()); // if the original word was misspelled, use the spell correction String suggestion = wordAnnotation.getSuggestion(); if ((suggestion != null) && (suggestion.length() > 0)) { word = suggestion; } // skip past words that are part of the exclusion set if (exclusionSet.contains(word)) continue; setCanonicalForm(wordAnnotation, word); if (postLemmas) setLemma(wordAnnotation, word, jcas); } } }
/** * A utility method that annotates a given range. */ protected void annotateRange(JCas jcas, String text, int rangeBegin, int rangeEnd) throws AnalysisEngineProcessException { JFSIndexRepository indexes = jcas.getJFSIndexRepository(); Iterator<?> wordItr = indexes.getAnnotationIndex(WordToken.type) .iterator(); while (wordItr.hasNext()) { WordToken wordAnnotation = (WordToken) wordItr.next(); if (wordAnnotation.getBegin() >= rangeBegin && wordAnnotation.getEnd() <= rangeEnd) { String word = text.substring(wordAnnotation.getBegin(), wordAnnotation.getEnd()); // if the original word was misspelled, use the spell correction String suggestion = wordAnnotation.getSuggestion(); if ((suggestion != null) && (suggestion.length() > 0)) { word = suggestion; } // skip past words that are part of the exclusion set if (exclusionSet.contains(word)) continue; setCanonicalForm(wordAnnotation, word); if (postLemmas) setLemma(wordAnnotation, word, jcas); } } }
ret.add(t); if (s.equalsIgnoreCase("it")) offset2token.put(t.getBegin()+"-"+t.getEnd(), t);
ret.add(t); if (s.equalsIgnoreCase("it")) offset2token.put(t.getBegin()+"-"+t.getEnd(), t);
private static Markable getDoctorMarkable(JCas jcas, WordToken drToken){ Markable markable = null; ConllDependencyNode nnpHead = DependencyUtility.getDependencyNode(jcas, drToken); try{ while(nnpHead != null && nnpHead.getHead() != null && nnpHead.getHead().getId() != 0 && nnpHead.getHead().getPostag().equals("NNP")){ nnpHead = nnpHead.getHead(); } }catch(NullPointerException e){ System.err.print("."); } int start = drToken.getBegin(); int end = nnpHead.getEnd(); if(end < start) end = drToken.getEnd(); markable = new Markable(jcas, start, end); return markable; } }
private static Markable getDoctorMarkable(JCas jcas, WordToken drToken){ Markable markable = null; ConllDependencyNode nnpHead = DependencyUtility.getDependencyNode(jcas, drToken); try{ while(nnpHead != null && nnpHead.getHead() != null && nnpHead.getHead().getId() != 0 && nnpHead.getHead().getPostag().equals("NNP")){ nnpHead = nnpHead.getHead(); } }catch(NullPointerException e){ System.err.print("."); } int start = drToken.getBegin(); int end = nnpHead.getEnd(); if(end < start) end = drToken.getEnd(); markable = new Markable(jcas, start, end); return markable; } }
@Override public void process(JCas aJCas) throws AnalysisEngineProcessException { ArrayList<Annotation> la = AnnotationSelector.selectNE(aJCas); for (int i = 0; i < la.size(); ++i) { Annotation a = la.get(i); NEMarkable m = new NEMarkable(aJCas, a.getBegin(), a.getEnd()); m.setContent(a); m.setId(nextID + i); m.addToIndexes(); } nextID += la.size(); ArrayList<WordToken> lw = AnnotationSelector.selectPronoun(aJCas, modalAdj, cogved, otherVerb, logger); for (int i = 0; i < lw.size(); ++i) { WordToken t = lw.get(i); PronounMarkable m = new PronounMarkable(aJCas, t.getBegin(), t.getEnd()); m.setContent(t); m.setId(nextID + i); m.addToIndexes(); } nextID += lw.size(); ArrayList<Chunk> lc = AnnotationSelector.selectDemonAndRelative(aJCas); for (int i = 0; i < lc.size(); ++i) { Chunk c = lc.get(i); DemMarkable m = new DemMarkable(aJCas, c.getBegin(), c.getEnd()); m.setContent(c); m.setId(nextID + i); m.addToIndexes(); } nextID += lc.size(); }
@Override public void process(JCas aJCas) throws AnalysisEngineProcessException { ArrayList<Annotation> la = AnnotationSelector.selectNE(aJCas); for (int i = 0; i < la.size(); ++i) { Annotation a = la.get(i); NEMarkable m = new NEMarkable(aJCas, a.getBegin(), a.getEnd()); m.setContent(a); m.setId(nextID + i); m.addToIndexes(); } nextID += la.size(); ArrayList<WordToken> lw = AnnotationSelector.selectPronoun(aJCas, modalAdj, cogved, otherVerb, logger); for (int i = 0; i < lw.size(); ++i) { WordToken t = lw.get(i); PronounMarkable m = new PronounMarkable(aJCas, t.getBegin(), t.getEnd()); m.setContent(t); m.setId(nextID + i); m.addToIndexes(); } nextID += lw.size(); ArrayList<Chunk> lc = AnnotationSelector.selectDemonAndRelative(aJCas); for (int i = 0; i < lc.size(); ++i) { Chunk c = lc.get(i); DemMarkable m = new DemMarkable(aJCas, c.getBegin(), c.getEnd()); m.setContent(c); m.setId(nextID + i); m.addToIndexes(); } nextID += lc.size(); }
if(word.getPartOfSpeech().startsWith("PRP")){ if(text.equalsIgnoreCase("I") || text.equalsIgnoreCase("me") || text.equalsIgnoreCase("my")){ Markable drMention = new Markable(jcas, word.getBegin(), word.getEnd()); addToList(jcas, drList, drMention); }else if(text.equalsIgnoreCase("we") || text.equalsIgnoreCase("us") || text.equalsIgnoreCase("our")){ Markable weMention = new Markable(jcas, word.getBegin(), word.getEnd()); addToList(jcas, weList, weMention); }else if(text.equalsIgnoreCase("it")){ Markable ptMention = new Markable(jcas, word.getBegin(), word.getEnd()); addToList(jcas, ptList, ptMention); }else if(text.equalsIgnoreCase("mrs.") || text.equalsIgnoreCase("mr.") || text.equalsIgnoreCase("ms.")){ Markable ptMention = new Markable(jcas, word.getBegin(), words.get(i+1).getEnd()); addToList(jcas, ptList, ptMention); }else if(text.equalsIgnoreCase("patient") || text.equalsIgnoreCase("pt")){ Markable ptMention = new Markable(jcas, word.getBegin(), word.getEnd()); addToList(jcas, ptList, ptMention);
if(word.getPartOfSpeech().startsWith("PRP")){ if(text.equalsIgnoreCase("I") || text.equalsIgnoreCase("me") || text.equalsIgnoreCase("my")){ Markable drMention = new Markable(jcas, word.getBegin(), word.getEnd()); addToList(jcas, drList, drMention); }else if(text.equalsIgnoreCase("we") || text.equalsIgnoreCase("us") || text.equalsIgnoreCase("our")){ Markable weMention = new Markable(jcas, word.getBegin(), word.getEnd()); addToList(jcas, weList, weMention); }else if(text.equalsIgnoreCase("it")){ Markable ptMention = new Markable(jcas, word.getBegin(), word.getEnd()); addToList(jcas, ptList, ptMention); }else if(text.equalsIgnoreCase("mrs.") || text.equalsIgnoreCase("mr.") || text.equalsIgnoreCase("ms.")){ Markable ptMention = new Markable(jcas, word.getBegin(), words.get(i+1).getEnd()); addToList(jcas, ptList, ptMention); }else if(text.equalsIgnoreCase("patient") || text.equalsIgnoreCase("pt")){ Markable ptMention = new Markable(jcas, word.getBegin(), word.getEnd()); addToList(jcas, ptList, ptMention);