Example usage for edu.stanford.nlp.util TwoDimensionalSet secondKeySet

List of usage examples for edu.stanford.nlp.util TwoDimensionalSet secondKeySet

Introduction

In this page you can find the example usage for edu.stanford.nlp.util TwoDimensionalSet secondKeySet.

Prototype

public Set<K2> secondKeySet(K1 k1) 

Source Link

Usage

From source file:knu.univ.lingvo.coref.Document.java

License:Open Source License

public void mergeAcronymCache(CorefCluster to, CorefCluster from) {
    TwoDimensionalSet<Integer, Integer> replacements = TwoDimensionalSet.hashSet();
    for (Integer first : acronymCache.firstKeySet()) {
        for (Integer second : acronymCache.get(first).keySet()) {
            if (acronymCache.get(first, second)) {
                Integer other = null;
                if (first == from.clusterID) {
                    other = second;/* ww  w .  ja  v a  2  s.  c o  m*/
                } else if (second == from.clusterID) {
                    other = first;
                }
                if (other != null && other != to.clusterID) {
                    int cid1 = Math.min(other, to.clusterID);
                    int cid2 = Math.max(other, to.clusterID);
                    replacements.add(cid1, cid2);
                }
            }
        }
    }
    for (Integer first : replacements.firstKeySet()) {
        for (Integer second : replacements.secondKeySet(first)) {
            acronymCache.put(first, second, true);
        }
    }
}