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

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

Introduction

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

Prototype

public boolean add(K1 k1, K2 k2) 

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;//from ww  w.ja  v a  2  s .c om
                } 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);
        }
    }
}