@Test public final void testCBCClusters() { ge.addView(ta); assertTrue(ta.getView(ge.getViewName()).getConstituents().size() > 15); }
@Override public void addView(TextAnnotation ta) { if (!this.loaded) { synchronized (this) { if (!this.loaded) { try { lazyLoadGazetteers(directory, gzip, loadFromClasspath); } catch (Exception e) { throw new RuntimeException(e); } } } } SpanLabelView view = new SpanLabelView(ViewNames.GAZETTEER, "Gazetteers", ta, 1.0, true); TIntObjectHashMap<ArrayList<IntPair>> allSpans = hashAllSpans(ta); for (int i = 0; i < names.size(); i++) { String label = names.get(i); if (!this.ignore.contains(label)) { addView(label, i, view, allSpans); } } SpanLabelView newView = new SpanLabelView(ViewNames.GAZETTEER, "Gazetteers", ta, 1.0, true); for (Constituent c : view) { Pair<Constituent, SpanLabelView> input = new Pair<>(c, view); boolean allow = true; for (Predicate<Pair<Constituent, SpanLabelView>> filter : this.gazetteerFilters) { if (!filter.transform(input)) { allow = false; logger.debug("Not labeling constituent {} as {} because it failed a filter", c, c.getLabel()); break; } } if (allow) newView.addSpanLabel(c.getStartSpan(), c.getEndSpan(), c.getLabel(), c.getConstituentScore()); } ta.addView(getViewName(), newView); }
GazetteerViewGenerator extends Annotator { @Override public void addView(TextAnnotation ta) { if (!this.loaded) { synchronized (this) { if (!this.loaded) { try { lazyLoadGazetteers(directory, gzip, loadFromClasspath); } catch (Exception e) { throw new RuntimeException(e); } } } } SpanLabelView view = new SpanLabelView(ViewNames.GAZETTEER, "Gazetteers", ta, 1.0, true); TIntObjectHashMap<ArrayList<IntPair>> allSpans = hashAllSpans(ta); for (int i = 0; i < names.size(); i++) { String label = names.get(i); if (!this.ignore.contains(label)) { addView(label, i, view, allSpans); } } SpanLabelView newView = new SpanLabelView(ViewNames.GAZETTEER, "Gazetteers", ta, 1.0, true); for (Constituent c : view) { Pair<Constituent, SpanLabelView> input = new Pair<>(c, view); boolean allow = true; for (Predicate<Pair<Constituent, SpanLabelView>> filter : this.gazetteerFilters) { if (!filter.transform(input)) { allow = false; logger.debug("Not labeling constituent {} as {} because it failed a filter", c, c.getLabel()); break; } } if (allow) newView.addSpanLabel(c.getStartSpan(), c.getEndSpan(), c.getLabel(), c.getConstituentScore()); } ta.addView(getViewName(), newView); } }
GazetteerViewGenerator extends Annotator { @Override public void addView(TextAnnotation ta) { if (!this.loaded) { synchronized (this) { if (!this.loaded) { try { lazyLoadGazetteers(directory, gzip, loadFromClasspath); } catch (Exception e) { throw new RuntimeException(e); } } } } SpanLabelView view = new SpanLabelView(ViewNames.GAZETTEER, "Gazetteers", ta, 1.0, true); TIntObjectHashMap<ArrayList<IntPair>> allSpans = hashAllSpans(ta); for (int i = 0; i < names.size(); i++) { String label = names.get(i); if (!this.ignore.contains(label)) { addView(label, i, view, allSpans); } } SpanLabelView newView = new SpanLabelView(ViewNames.GAZETTEER, "Gazetteers", ta, 1.0, true); for (Constituent c : view) { Pair<Constituent, SpanLabelView> input = new Pair<>(c, view); boolean allow = true; for (Predicate<Pair<Constituent, SpanLabelView>> filter : this.gazetteerFilters) { if (!filter.transform(input)) { allow = false; logger.debug("Not labeling constituent {} as {} because it failed a filter", c, c.getLabel()); break; } } if (allow) newView.addSpanLabel(c.getStartSpan(), c.getEndSpan(), c.getLabel(), c.getConstituentScore()); } ta.addView(getViewName(), newView); } GazetteerViewGenerator(String directory, String viewName, boolean loadFromClasspath);  GazetteerViewGenerator(String directory, boolean gzip, String viewName, boolean loadFromClasspath); }
GazetteerViewGenerator extends Annotator { @Override public void addView(TextAnnotation ta) { if (!this.loaded) { synchronized (this) { if (!this.loaded) { try { lazyLoadGazetteers(directory, gzip, loadFromClasspath); } catch (Exception e) { throw new RuntimeException(e); } } } } SpanLabelView view = new SpanLabelView(ViewNames.GAZETTEER, "Gazetteers", ta, 1.0, true); TIntObjectHashMap<ArrayList<IntPair>> allSpans = hashAllSpans(ta); for (int i = 0; i < names.size(); i++) { String label = names.get(i); if (!this.ignore.contains(label)) { addView(label, i, view, allSpans); } } SpanLabelView newView = new SpanLabelView(ViewNames.GAZETTEER, "Gazetteers", ta, 1.0, true); for (Constituent c : view) { Pair<Constituent, SpanLabelView> input = new Pair<>(c, view); boolean allow = true; for (Predicate<Pair<Constituent, SpanLabelView>> filter : this.gazetteerFilters) { if (!filter.transform(input)) { allow = false; logger.debug("Not labeling constituent {} as {} because it failed a filter", c, c.getLabel()); break; } } if (allow) newView.addSpanLabel(c.getStartSpan(), c.getEndSpan(), c.getLabel(), c.getConstituentScore()); } ta.addView(getViewName(), newView); } GazetteerViewGenerator(String directory, String viewName, boolean loadFromClasspath);  GazetteerViewGenerator(String directory, boolean gzip, String viewName, boolean loadFromClasspath); @SuppressWarnings("serial") static void addGazetteerFilters(GazetteerViewGenerator gazetteers); static void main(String[] args); void addFilter(Predicate<Pair<Constituent, SpanLabelView>> filter); void ignoreGazetteer(String label); List<String> getGazetteerNames(); @Override void initialize(ResourceManager rm); @Override void addView(TextAnnotation ta); @Override String[] getRequiredViews(); }
GazetteerViewGenerator extends Annotator { @Override public void addView(TextAnnotation ta) { if (!this.loaded) { synchronized (this) { if (!this.loaded) { try { lazyLoadGazetteers(directory, gzip, loadFromClasspath); } catch (Exception e) { throw new RuntimeException(e); } } } } SpanLabelView view = new SpanLabelView(ViewNames.GAZETTEER, "Gazetteers", ta, 1.0, true); TIntObjectHashMap<ArrayList<IntPair>> allSpans = hashAllSpans(ta); for (int i = 0; i < names.size(); i++) { String label = names.get(i); if (!this.ignore.contains(label)) { addView(label, i, view, allSpans); } } SpanLabelView newView = new SpanLabelView(ViewNames.GAZETTEER, "Gazetteers", ta, 1.0, true); for (Constituent c : view) { Pair<Constituent, SpanLabelView> input = new Pair<>(c, view); boolean allow = true; for (Predicate<Pair<Constituent, SpanLabelView>> filter : this.gazetteerFilters) { if (!filter.transform(input)) { allow = false; logger.debug("Not labeling constituent {} as {} because it failed a filter", c, c.getLabel()); break; } } if (allow) newView.addSpanLabel(c.getStartSpan(), c.getEndSpan(), c.getLabel(), c.getConstituentScore()); } ta.addView(getViewName(), newView); } GazetteerViewGenerator(String directory, String viewName, boolean loadFromClasspath);  GazetteerViewGenerator(String directory, boolean gzip, String viewName, boolean loadFromClasspath); @SuppressWarnings("serial") static void addGazetteerFilters(GazetteerViewGenerator gazetteers); static void main(String[] args); void addFilter(Predicate<Pair<Constituent, SpanLabelView>> filter); void ignoreGazetteer(String label); List<String> getGazetteerNames(); @Override void initialize(ResourceManager rm); @Override void addView(TextAnnotation ta); @Override String[] getRequiredViews(); static final GazetteerViewGenerator gazetteersInstance; }