private Map<String, List<IntPair>> getMatchingSpans(TextAnnotation ta) { Map<String, List<IntPair>> map = new HashMap<>(); for (Entry<String, List<String>> entry : this.clusterToStrings.entrySet()) { String clusterId = entry.getKey(); List<String> patterns = entry.getValue(); for (String pattern : patterns) { List<IntPair> list = ta.getSpansMatching(pattern); if (list.size() > 0) { if (!map.containsKey(clusterId)) map.put(clusterId, new ArrayList<IntPair>()); map.get(clusterId).addAll(list); } } } return map; } }
private Map<String, List<IntPair>> getMatchingSpans(TextAnnotation ta) { Map<String, List<IntPair>> map = new HashMap<>(); for (Entry<String, List<String>> entry : this.clusterToStrings.entrySet()) { String clusterId = entry.getKey(); List<String> patterns = entry.getValue(); for (String pattern : patterns) { List<IntPair> list = ta.getSpansMatching(pattern); if (list.size() > 0) { if (!map.containsKey(clusterId)) map.put(clusterId, new ArrayList<IntPair>()); map.get(clusterId).addAll(list); } } } return map; } }
for(IntPair span : ta.getSpansMatching(context)){ IntPair nextspan = new IntPair(span.getSecond(), span.getSecond()+1); if(span.getSecond() < ta.size()) { for(IntPair span : ta.getSpansMatching(context)){ IntPair prevspan = new IntPair(span.getFirst()-1, span.getFirst()); if(span.getFirst() > 0) { for(IntPair span : ta.getSpansMatching(surface)){ Suggestion s = new Suggestion(span, label, String.format("%s for %s, weight: %f", featname, label, patterns.get(feat))); suggestions.add(s);
List<IntPair> spans = ta.getSpansMatching(surface);
for (String pattern : currencies) { List<IntPair> list = ta.getSpansMatching(pattern);
for (String pattern : currencies) { List<IntPair> list = ta.getSpansMatching(pattern);
boolean propagate = true; if(propagate){ spans = ta.getSpansMatching(text);
List<IntPair> startEndPos = ta.getSpansMatching(currStr); currSpan = ta.getSpansMatching("2009-2010").get(0); charStart = ta.getTokenCharacterOffset(currSpan.getFirst()).getFirst(); charEnd = ta.getTokenCharacterOffset(currSpan.getFirst()).getSecond()-5; currSpan = ta.getSpansMatching("2009-2010").get(0); charStart = ta.getTokenCharacterOffset(currSpan.getFirst()).getFirst()+5; charEnd = ta.getTokenCharacterOffset(currSpan.getFirst()).getSecond();
List<IntPair> startEndPos = ta.getSpansMatching(currStr); currSpan = ta.getSpansMatching("2009-2010").get(0); charStart = ta.getTokenCharacterOffset(currSpan.getFirst()).getFirst(); charEnd = ta.getTokenCharacterOffset(currSpan.getFirst()).getSecond()-5; currSpan = ta.getSpansMatching("2009-2010").get(0); charStart = ta.getTokenCharacterOffset(currSpan.getFirst()).getFirst()+5; charEnd = ta.getTokenCharacterOffset(currSpan.getFirst()).getSecond();