public CorefCluster(int ID) { clusterID = ID; corefMentions = Generics.newHashSet(); numbers = EnumSet.noneOf(Number.class); genders = EnumSet.noneOf(Gender.class); animacies = EnumSet.noneOf(Animacy.class); nerStrings = Generics.newHashSet(); heads = Generics.newHashSet(); words = Generics.newHashSet(); firstMention = null; representative = null; }
/** Find predicate nominatives */ public void addPredicateNominatives(Mention m) { if(predicateNominatives == null) predicateNominatives = Generics.newHashSet(); predicateNominatives.add(m); }
/** * Returns the difference of sets s1 and s2. */ public static <E> Set<E> diff(Set<E> s1, Set<E> s2) { Set<E> s = Generics.newHashSet(); for (E o : s1) { if (!s2.contains(o)) { s.add(o); } } return s; }
/** * Returns the Set of entities recognized by this Classifier. * * @return The Set of entities recognized by this Classifier. */ public Set<String> getTags() { Set<String> tags = Generics.newHashSet(classIndex.objectsList()); tags.remove(flags.backgroundSymbol); return tags; }
protected Set<?> makeObjects(Tree tree) { Set<Constituent> set = Generics.newHashSet(); if (tree != null) { set.addAll(tree.constituents(cf, false, subtreeFilter)); } return set; }
@SuppressWarnings({"unchecked", "SuspiciousMethodCalls"}) private void makeGenericKeyCache(CoreLabel c) { genericAnnotationKeys = Generics.newHashSet(); for (Class<?> key : c.keySet()) { if (CoreLabel.genericValues.containsKey(key)) { Class<? extends GenericAnnotation<?>> genKey = (Class<? extends GenericAnnotation<?>>) key; genericAnnotationKeys.add(genKey); } } }
public static Set<String> findKnownStates(List<Tree> binarizedTrees) { Set<String> knownStates = Generics.newHashSet(); for (Tree tree : binarizedTrees) { findKnownStates(tree, knownStates); } return Collections.unmodifiableSet(knownStates); }
public static Collection<SemanticGraph> removeDuplicates(Collection<SemanticGraph> graphs, SemanticGraph tabuGraph) { Collection<SemanticGraph> tabuSet = Generics.newHashSet(); tabuSet.add(tabuGraph); return removeDuplicates(graphs, tabuSet); }
public Set<DFSAState<T, S>> statesReachable() { Set<DFSAState<T, S>> visited = Generics.newHashSet(); List<DFSAState<T, S>> toVisit = new ArrayList<>(); toVisit.add(this); exploreStates(toVisit, visited); return visited; }
public static Set<String> readFamilyRelations(String filename) { Set<String> familyRelations = Generics.newHashSet(); List<String> lines = IOUtils.linesFromFile(filename); for (String line : lines) { if (line.trim().length() > 0) { familyRelations.add(line.toLowerCase().trim()); } } return familyRelations; }
public static Set<String> readAnimacyList(String filename) { Set<String> animacyList = Generics.newHashSet(); List<String> lines = IOUtils.linesFromFile(filename); for (String line : lines) { if (!Character.isUpperCase(line.charAt(0))) //ignore names animacyList.add(line); } return animacyList; }
public Sieve() { this.lang = Locale.ENGLISH; this.sievename = this.getClass().getSimpleName(); this.aType = new HashSet<>(Arrays.asList(MentionType.values())); this.mType = new HashSet<>(Arrays.asList(MentionType.values())); this.maxSentDist = 1000; this.mTypeStr = Generics.newHashSet(); this.aTypeStr = Generics.newHashSet(); }
protected static void examineIntersection(Set<String> s1, Set<String> s2) { Set<String> knownTypes = Generics.newHashSet(s1); knownTypes.retainAll(s2); if (knownTypes.size() != 0) { System.err.printf("|intersect|: %d%n", knownTypes.size()); for (String word : knownTypes) { log.info(word + " "); } log.info(); } }
private static boolean isContextOverlapping(Mention m1, Mention m2) { Set<String> context1 = Generics.newHashSet(); Set<String> context2 = Generics.newHashSet(); context1.addAll(m1.getContext()); context2.addAll(m2.getContext()); return Sets.intersects(context1, context2); }
public Set<DFSAState<T, S>> states() { Set<DFSAState<T, S>> visited = Generics.newHashSet(); List<DFSAState<T,S>> toVisit = new ArrayList<>(); toVisit.add(initialState()); exploreStates(toVisit, visited); return visited; }
public Set<K2> secondKeySet() { Set<K2> keys = Generics.newHashSet(); for (K1 k1 : map.keySet()) { keys.addAll(get(k1).firstKeySet()); } return keys; }
@Override public ExplicitTemporalSet setTimeZone(DateTimeZone tz) { Set<Temporal> tzTemporals = Generics.newHashSet(temporals.size()); for (Temporal t:temporals) { tzTemporals.add(Temporal.setTimeZone(t, tz)); } return new ExplicitTemporalSet(this, tzTemporals); }
@Override protected Set<String> makeObjects(Tree tree) { Set<String> localTrees = Generics.newHashSet(); for (Tree st : tree.subTreeList()) { localTrees.add(localize(st)); } return localTrees; }
public Set<K3> thirdKeySet() { Set<K3> keys = Generics.newHashSet(); for (K1 k1 : map.keySet()) { ThreeDimensionalMap<K2,K3,K4,V> m3 = map.get(k1); for (K2 k2 : m3.firstKeySet()) { keys.addAll(m3.get(k2).firstKeySet()); } } return keys; }
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); Set<UnaryRule> allRules = Generics.newHashSet(coreRules.keySet()); init(); for (UnaryRule ur : allRules) { addRule(ur); } purgeRules(); }