public SequenceMatchResult<T> apply(SequenceMatchResult<T> matchResult, int... groups) { for (int group:groups) { int groupStart = matchResult.start(group); if (groupStart >=0) { int groupEnd = matchResult.end(group); ChunkAnnotationUtils.annotateChunks(matchResult.elements(), groupStart, groupEnd, attributes); } } return matchResult; }
Collections.sort(orderedGroups); for (int group:orderedGroups) { int groupStart = matchResult.start(group); if (groupStart >= last) { while (mergedGroup < res.matchedGroups.length) { if (res.matchedGroups[mergedGroup] != null) { if (res.matchedGroups[mergedGroup].matchBegin == matchResult.start(group) && res.matchedGroups[mergedGroup].matchEnd == matchResult.end(group)) { res.matchedGroups[mergedGroup].matchBegin = res.matchedGroups[group].matchBegin;
@Override public MatchedExpression apply(SequenceMatchResult<CoreMap> matched) { MatchedExpression te = extractor.createMatchedExpression(null, Interval.toInterval(matched.start(group), matched.end(group), Interval.INTERVAL_OPEN_END)); if (Double.isNaN(te.priority)) { te.priority = matched.priority(); } if (Double.isNaN(te.weight)) { te.weight = matched.score(); } if (this.group != 0) { // Save context so value evaluation can happen te.context = matched.toBasicSequenceMatchResult(); } return te; } }
int s = m.start("$term"); int e = m.end("$term"); E matchedPat = patterns.get(m.pattern());
int start = m.start(g); int end = m.end(g);
public MatchedExpression apply(SequenceMatchResult<CoreMap> matched) { MatchedExpression te = extractor.createMatchedExpression(null, Interval.toInterval(matched.start(group), matched.end(group), Interval.INTERVAL_OPEN_END)); return te; } }
public SequenceMatchResult<T> apply(SequenceMatchResult<T> matchResult, int... groups) { for (int group:groups) { int groupStart = matchResult.start(group); if (groupStart >=0) { int groupEnd = matchResult.end(group); ChunkAnnotationUtils.annotateChunks(matchResult.elements(), groupStart, groupEnd, attributes); } } return matchResult; }
public SequenceMatchResult<T> apply(SequenceMatchResult<T> matchResult, int... groups) { for (int group:groups) { int groupStart = matchResult.start(group); if (groupStart >=0) { int groupEnd = matchResult.end(group); ChunkAnnotationUtils.annotateChunks(matchResult.elements(), groupStart, groupEnd, attributes); } } return matchResult; }
public SequenceMatchResult<T> apply(SequenceMatchResult<T> matchResult, int... groups) { for (int group:groups) { int groupStart = matchResult.start(group); if (groupStart >=0) { int groupEnd = matchResult.end(group); ChunkAnnotationUtils.annotateChunks(matchResult.elements(), groupStart, groupEnd, attributes); } } return matchResult; }
public SequenceMatchResult<T> apply(SequenceMatchResult<T> matchResult, int... groups) { for (int group:groups) { int groupStart = matchResult.start(group); if (groupStart >=0) { int groupEnd = matchResult.end(group); ChunkAnnotationUtils.annotateChunks(matchResult.elements(), groupStart, groupEnd, attributes); } } return matchResult; }
@Override public MatchedExpression apply(SequenceMatchResult<CoreMap> matched) { MatchedExpression te = extractor.createMatchedExpression(null, Interval.toInterval(matched.start(group), matched.end(group), Interval.INTERVAL_OPEN_END)); if (Double.isNaN(te.priority)) { te.priority = matched.priority(); } if (Double.isNaN(te.weight)) { te.weight = matched.score(); } if (this.group != 0) { // Save context so value evaluation can happen te.context = matched.toBasicSequenceMatchResult(); } return te; } }
Collections.sort(orderedGroups); for (int group:orderedGroups) { int groupStart = matchResult.start(group); if (groupStart >= last) { while (mergedGroup < res.matchedGroups.length) { if (res.matchedGroups[mergedGroup] != null) { if (res.matchedGroups[mergedGroup].matchBegin == matchResult.start(group) && res.matchedGroups[mergedGroup].matchEnd == matchResult.end(group)) { res.matchedGroups[mergedGroup].matchBegin = res.matchedGroups[group].matchBegin;
Collections.sort(orderedGroups); for (int group:orderedGroups) { int groupStart = matchResult.start(group); if (groupStart >= last) { while (mergedGroup < res.matchedGroups.length) { if (res.matchedGroups[mergedGroup] != null) { if (res.matchedGroups[mergedGroup].matchBegin == matchResult.start(group) && res.matchedGroups[mergedGroup].matchEnd == matchResult.end(group)) { res.matchedGroups[mergedGroup].matchBegin = res.matchedGroups[group].matchBegin;
Collections.sort(orderedGroups); for (int group:orderedGroups) { int groupStart = matchResult.start(group); if (groupStart >= last) { while (mergedGroup < res.matchedGroups.length) { if (res.matchedGroups[mergedGroup] != null) { if (res.matchedGroups[mergedGroup].matchBegin == matchResult.start(group) && res.matchedGroups[mergedGroup].matchEnd == matchResult.end(group)) { res.matchedGroups[mergedGroup].matchBegin = res.matchedGroups[group].matchBegin;
@Override public MatchedExpression apply(SequenceMatchResult<CoreMap> matched) { MatchedExpression te = extractor.createMatchedExpression(null, Interval.toInterval(matched.start(group), matched.end(group), Interval.INTERVAL_OPEN_END)); if (Double.isNaN(te.priority)) { te.priority = matched.priority(); } if (Double.isNaN(te.weight)) { te.weight = matched.score(); } if (this.group != 0) { // Save context so value evaluation can happen te.context = matched.toBasicSequenceMatchResult(); } return te; } }
Collections.sort(orderedGroups); for (int group:orderedGroups) { int groupStart = matchResult.start(group); if (groupStart >= last) { while (mergedGroup < res.matchedGroups.length) { if (res.matchedGroups[mergedGroup] != null) { if (res.matchedGroups[mergedGroup].matchBegin == matchResult.start(group) && res.matchedGroups[mergedGroup].matchEnd == matchResult.end(group)) { res.matchedGroups[mergedGroup].matchBegin = res.matchedGroups[group].matchBegin;
private void annotateMatched(List<CoreLabel> tokens) { List<SequenceMatchResult<CoreMap>> matched = multiPatternMatcher.findNonOverlapping(tokens); for (SequenceMatchResult<CoreMap> m:matched) { Entry entry = patternToEntry.get(m.pattern()); // Check if we will overwrite the existing annotation with this annotation int g = entry.annotateGroup; int start = m.start(g); int end = m.end(g); boolean overwriteOriginalNer = checkPosTags(tokens, start, end); if (overwriteOriginalNer) { overwriteOriginalNer = checkOrigNerTags(entry, tokens, start, end); } if (overwriteOriginalNer) { for (int i = start; i < end; i++) { tokens.get(i).set(CoreAnnotations.NamedEntityTagAnnotation.class, entry.type); } } else { if (verbose) { System.err.println("Not annotating '" + m.group(g) + "': " + StringUtils.joinFields(m.groupNodes(g), CoreAnnotations.NamedEntityTagAnnotation.class) + " with " + entry.type + ", sentence is '" + StringUtils.joinWords(tokens, " ") + "'"); } } } }
int s = m.start("$term"); int e = m.end("$term"); SurfacePattern matchedPat = patterns.get(m.pattern());
int start = m.start(g); int end = m.end(g);