Permalink
Cannot retrieve contributors at this time
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?
HowToKB/src/main/java/kb/howtokb/clustering/ActivityCachedSim.java
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
37 lines (30 sloc)
1016 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
} |