Skip to content
Permalink
0d82ff1dc4
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
37 lines (30 sloc) 1016 Bytes
package kb.howtokb.clustering;
import edu.stanford.nlp.util.Pair;
import kb.howtokb.utils.BijectiveMap;
public class ActivityCachedSim {
private BijectiveMap<String, Pair<Integer, Integer>> ids;
private ActivityComponentSim vSim, nSim;
public ActivityCachedSim(BijectiveMap<String, Pair<Integer, Integer>> ids, ActivityComponentSim vSim,
ActivityComponentSim nSim) {
this.ids = ids;
this.vSim = vSim;
this.nSim = nSim;
}
private boolean sim(Pair<Integer, Integer> e1, Pair<Integer, Integer> e2) {
// return
// // v1 v2 are similar
// vSim.simFromCache(e1.first, e2.first) &&
// // n1 v2 are similar
// nSim.simFromCache(e1.second, e2.second);
if (!vSim.simFromCache(e1.first, e2.first) &&
// n1 v2 are similar
!nSim.simFromCache(e1.second, e2.second))
return false;
return true;
}
public boolean sim(String a1, String a2) {
Pair<Integer, Integer> e1 = this.ids.getValueFromKey(a1);
Pair<Integer, Integer> e2 = this.ids.getValueFromKey(a2);
return sim(e1, e2);
}
}