public static boolean isSymmetric(Measure measure) throws WikiRelatednessException { if (isSymmetricMap.containsKey(measure)) { return isSymmetricMap.get(measure); } else { throw new WikiRelatednessException("unknown measure " + measure); } }
public static boolean isSymmetric(Measure measure) throws WikiRelatednessException { if (isSymmetricMap.containsKey(measure)) { return isSymmetricMap.get(measure); } else { throw new WikiRelatednessException("unknown measure " + measure); } }
/** * Combines the relatedness values that have been computed between the categories of an article using a given combination strategy. * @param relatednessValues A list with the relatedness values. * @return The combined relatedness value. */ public double combineRelatedness(List<Double> relatednessValues) throws WikiRelatednessException { double combinedRelatedness = -1.0; if (strategy.equals(CombinationStrategy.Average) || strategy.equals(CombinationStrategy.SelectivityLinear) || strategy.equals(CombinationStrategy.SelectivityLog)) { combinedRelatedness = computeAverageRelatedness(relatednessValues); } // If CombinationStrategy is "none" then there is only a single result value and we do not have to combine anything. // But inheritence structure makes it necessary to have a combination of relatedness values computed. // So we use findSmallestRelatedness for "none" as this will select the smallest (that is the only value) in the list :) else if (strategy.equals(CombinationStrategy.Best) || strategy.equals(CombinationStrategy.None)) { combinedRelatedness = getBestRelatedness(relatednessValues); } else { throw new WikiRelatednessException("Unknown combination strategy " + strategy); } return combinedRelatedness; }
/** * Combines the relatedness values that have been computed between the categories of an article using a given combination strategy. * @param relatednessValues A list with the relatedness values. * @return The combined relatedness value. */ public double combineRelatedness(List<Double> relatednessValues) throws WikiRelatednessException { double combinedRelatedness = -1.0; if (strategy.equals(CombinationStrategy.Average) || strategy.equals(CombinationStrategy.SelectivityLinear) || strategy.equals(CombinationStrategy.SelectivityLog)) { combinedRelatedness = computeAverageRelatedness(relatednessValues); } // If CombinationStrategy is "none" then there is only a single result value and we do not have to combine anything. // But inheritence structure makes it necessary to have a combination of relatedness values computed. // So we use findSmallestRelatedness for "none" as this will select the smallest (that is the only value) in the list :) else if (strategy.equals(CombinationStrategy.Best) || strategy.equals(CombinationStrategy.None)) { combinedRelatedness = getBestRelatedness(relatednessValues); } else { throw new WikiRelatednessException("Unknown combination strategy " + strategy); } return combinedRelatedness; }