/** * Compares the chunks at index i to the 1st element on the pattern, i+1 to * the 2nd element, etc and returns true if the chunks starting at i fit the * pattern * * @param list * the list of chunks * @param i * the position within the list to compare to the pattern * @return true if the pattern is matched by the chunks starting with * element <code>i</code> in the list. Note if there aren't enough * chunks in the list starting at i to match the pattern, returns * false. * @throws AnnotatorProcessException */ private boolean compareToPattern(List<Chunk> list, int i) { boolean match = true; int len = list.size(); for (int j = 0; j < chunksTypesInPattern.length; j++) { if (i + j >= len || !list.get(i + j).getChunkType() .equals(chunksTypesInPattern[j])) { match = false; // some part of pattern doesn't match chunks // starting at i break; } } return match; }
/** * Compares the chunks at index i to the 1st element on the pattern, i+1 to * the 2nd element, etc and returns true if the chunks starting at i fit the * pattern * * @param list * the list of chunks * @param i * the position within the list to compare to the pattern * @return true if the pattern is matched by the chunks starting with * element <code>i</code> in the list. Note if there aren't enough * chunks in the list starting at i to match the pattern, returns * false. * @throws AnnotatorProcessException */ private boolean compareToPattern(List<Chunk> list, int i) { boolean match = true; int len = list.size(); for (int j = 0; j < chunksTypesInPattern.length; j++) { if (i + j >= len || !list.get(i + j).getChunkType() .equals(chunksTypesInPattern[j])) { match = false; // some part of pattern doesn't match chunks // starting at i break; } } return match; }
@Override public void process( JCas jCas ) throws AnalysisEngineProcessException { for ( Chunk chunk : JCasUtil.select( jCas, Chunk.class ) ) { if ( chunk.getChunkType().equals( "NP" ) ) { new LookupWindowAnnotation( jCas, chunk.getBegin(), chunk.getEnd() ).addToIndexes(); } } } }
@Override public void process( JCas jCas ) throws AnalysisEngineProcessException { for ( Chunk chunk : JCasUtil.select( jCas, Chunk.class ) ) { if ( chunk.getChunkType().equals( "NP" ) ) { new LookupWindowAnnotation( jCas, chunk.getBegin(), chunk.getEnd() ).addToIndexes(); } } } }
public static ArrayList<Chunk> selectDemonAndRelative (JCas jcas) { ArrayList<Chunk> ret = new ArrayList<Chunk>(); FSIterator<Annotation> iter = jcas.getJFSIndexRepository().getAnnotationIndex(Chunk.type).iterator(); while (iter.hasNext()) { Chunk c = (Chunk)iter.next(); if (c.getChunkType().equals("NP")) { String s = c.getCoveredText().toLowerCase(); if (s.startsWith("these") || s.startsWith("those") || s.startsWith("this") || s.startsWith("that") || s.startsWith("which")) ret.add(c); } } java.util.Collections.sort(ret, new AnnotOffsetComparator()); return ret; } }
public static ArrayList<Chunk> selectDemonAndRelative (JCas jcas) { ArrayList<Chunk> ret = new ArrayList<Chunk>(); FSIterator<Annotation> iter = jcas.getJFSIndexRepository().getAnnotationIndex(Chunk.type).iterator(); while (iter.hasNext()) { Chunk c = (Chunk)iter.next(); if (c.getChunkType().equals("NP")) { String s = c.getCoveredText().toLowerCase(); if (s.startsWith("these") || s.startsWith("those") || s.startsWith("this") || s.startsWith("that") || s.startsWith("which")) ret.add(c); } } java.util.Collections.sort(ret, new AnnotOffsetComparator()); return ret; } }
((Chunk) mc).getChunkType().equals("NP")){ String s = mc.getCoveredText().toLowerCase(); if (s.startsWith("this") ||
((Chunk) mc).getChunkType().equals("NP")){ String s = mc.getCoveredText().toLowerCase(); if (s.startsWith("this") ||