public boolean contains(K1 k1, K2 k2) { return backingMap.contains(k1, k2); }
public static boolean entityIsAcronym(Document document, CorefCluster mentionCluster, CorefCluster potentialAntecedent) { int minId = Math.min(mentionCluster.clusterID, potentialAntecedent.clusterID); int maxId = Math.max(mentionCluster.clusterID, potentialAntecedent.clusterID); if(!document.acronymCache.contains(minId, maxId)) { boolean isAcronym = false; for(Mention m : mentionCluster.corefMentions){ if(m.isPronominal()) continue; for(Mention ant : potentialAntecedent.corefMentions){ if(isAcronym(m.originalSpan, ant.originalSpan)) isAcronym = true; } } document.acronymCache.put(minId, maxId, isAcronym); } return document.acronymCache.get(minId, maxId); }
if (calledMap.contains(this, other)) { return true;
/** * Add matrices from the second map to the first map, in place. */ public static void addMatrices(TwoDimensionalMap<String, String, SimpleMatrix> first, TwoDimensionalMap<String, String, SimpleMatrix> second) { for (TwoDimensionalMap.Entry<String, String, SimpleMatrix> entry : first) { if (second.contains(entry.getFirstKey(), entry.getSecondKey())) { first.put(entry.getFirstKey(), entry.getSecondKey(), entry.getValue().plus(second.get(entry.getFirstKey(), entry.getSecondKey()))); } } for (TwoDimensionalMap.Entry<String, String, SimpleMatrix> entry : second) { if (!first.contains(entry.getFirstKey(), entry.getSecondKey())) { first.put(entry.getFirstKey(), entry.getSecondKey(), entry.getValue()); } } }
/** * Add tensors from the second map to the first map, in place. */ public static void addTensors(TwoDimensionalMap<String, String, SimpleTensor> first, TwoDimensionalMap<String, String, SimpleTensor> second) { for (TwoDimensionalMap.Entry<String, String, SimpleTensor> entry : first) { if (second.contains(entry.getFirstKey(), entry.getSecondKey())) { first.put(entry.getFirstKey(), entry.getSecondKey(), entry.getValue().plus(second.get(entry.getFirstKey(), entry.getSecondKey()))); } } for (TwoDimensionalMap.Entry<String, String, SimpleTensor> entry : second) { if (!first.contains(entry.getFirstKey(), entry.getSecondKey())) { first.put(entry.getFirstKey(), entry.getSecondKey(), entry.getValue()); } } }
String left = basicCategory(binary.first); String right = basicCategory(binary.second); if (binaryTransform.contains(left, right)) { continue;
public static TwoDimensionalMap<String, String, SimpleMatrix> averageBinaryMatrices(List<TwoDimensionalMap<String, String, SimpleMatrix>> maps) { TwoDimensionalMap<String, String, SimpleMatrix> averages = TwoDimensionalMap.treeMap(); for (Pair<String, String> binary : getBinaryMatrixNames(maps)) { int count = 0; SimpleMatrix matrix = null; for (TwoDimensionalMap<String, String, SimpleMatrix> map : maps) { if (!map.contains(binary.first(), binary.second())) { continue; } SimpleMatrix original = map.get(binary.first(), binary.second()); ++count; if (matrix == null) { matrix = original; } else { matrix = matrix.plus(original); } } matrix = matrix.divide(count); averages.put(binary.first(), binary.second(), matrix); } return averages; }
String label = tree.label().value(); String childLabel = tree.getChild(0).label().value(); if (!unaryBetas.contains(label, childLabel)) { double[][] map = new double[1][1]; map[0][0] = 0.0;
public boolean contains(K1 k1, K2 k2) { return backingMap.contains(k1, k2); }
public boolean contains(K1 k1, K2 k2) { return backingMap.contains(k1, k2); }
public boolean contains(K1 k1, K2 k2) { return backingMap.contains(k1, k2); }
public static boolean entityIsAcronym(Document document, CorefCluster mentionCluster, CorefCluster potentialAntecedent) { int minId = Math.min(mentionCluster.clusterID, potentialAntecedent.clusterID); int maxId = Math.max(mentionCluster.clusterID, potentialAntecedent.clusterID); if(!document.acronymCache.contains(minId, maxId)) { boolean isAcronym = false; for(Mention m : mentionCluster.corefMentions){ if(m.isPronominal()) continue; for(Mention ant : potentialAntecedent.corefMentions){ if(isAcronym(m.originalSpan, ant.originalSpan)) isAcronym = true; } } document.acronymCache.put(minId, maxId, isAcronym); } return document.acronymCache.get(minId, maxId); }
public static boolean entityIsAcronym(Document document, CorefCluster mentionCluster, CorefCluster potentialAntecedent) { int minId = Math.min(mentionCluster.clusterID, potentialAntecedent.clusterID); int maxId = Math.max(mentionCluster.clusterID, potentialAntecedent.clusterID); if(!document.acronymCache.contains(minId, maxId)) { boolean isAcronym = false; for(Mention m : mentionCluster.corefMentions){ if(m.isPronominal()) continue; for(Mention ant : potentialAntecedent.corefMentions){ if(isAcronym(m.originalSpan, ant.originalSpan)) isAcronym = true; } } document.acronymCache.put(minId, maxId, isAcronym); } return document.acronymCache.get(minId, maxId); }
if (calledMap.contains(this, other)) { return true;
if (calledMap.contains(this, other)) { return true;
/** * Add tensors from the second map to the first map, in place. */ public static void addTensors(TwoDimensionalMap<String, String, SimpleTensor> first, TwoDimensionalMap<String, String, SimpleTensor> second) { for (TwoDimensionalMap.Entry<String, String, SimpleTensor> entry : first) { if (second.contains(entry.getFirstKey(), entry.getSecondKey())) { first.put(entry.getFirstKey(), entry.getSecondKey(), entry.getValue().plus(second.get(entry.getFirstKey(), entry.getSecondKey()))); } } for (TwoDimensionalMap.Entry<String, String, SimpleTensor> entry : second) { if (!first.contains(entry.getFirstKey(), entry.getSecondKey())) { first.put(entry.getFirstKey(), entry.getSecondKey(), entry.getValue()); } } }
/** * Add matrices from the second map to the first map, in place. */ public static void addMatrices(TwoDimensionalMap<String, String, SimpleMatrix> first, TwoDimensionalMap<String, String, SimpleMatrix> second) { for (TwoDimensionalMap.Entry<String, String, SimpleMatrix> entry : first) { if (second.contains(entry.getFirstKey(), entry.getSecondKey())) { first.put(entry.getFirstKey(), entry.getSecondKey(), entry.getValue().plus(second.get(entry.getFirstKey(), entry.getSecondKey()))); } } for (TwoDimensionalMap.Entry<String, String, SimpleMatrix> entry : second) { if (!first.contains(entry.getFirstKey(), entry.getSecondKey())) { first.put(entry.getFirstKey(), entry.getSecondKey(), entry.getValue()); } } }
String label = tree.label().value(); String childLabel = tree.getChild(0).label().value(); if (!unaryBetas.contains(label, childLabel)) { double[][] map = new double[1][1]; map[0][0] = 0.0;
String label = tree.label().value(); String childLabel = tree.getChild(0).label().value(); if (!unaryBetas.contains(label, childLabel)) { double[][] map = new double[1][1]; map[0][0] = 0.0;
String label = tree.label().value(); String childLabel = tree.getChild(0).label().value(); if (!unaryBetas.contains(label, childLabel)) { double[][] map = new double[1][1]; map[0][0] = 0.0;