@Test public void test() { Map<TermId, Integer> recipeToId = new HashMap<>(); Map<TermId, Set<TermId>> labels = new HashMap<>(); int nextId = 1; for (VegetableRecipeAnnotation a : recipeAnnotations) { if (!recipeToId.containsKey(a.getLabel())) { recipeToId.put(a.getLabel(), nextId++); } TermId recipeId = a.getTermId(); if (!labels.containsKey(recipeId)) { labels.put(recipeId, new HashSet<>()); } final Set<TermId> termIds = labels.get(recipeId); termIds.add(a.getTermId()); } Map<Integer, ScoreDistribution> samplingResult = scoreSampling.performSampling(); assertEquals(1, samplingResult.size()); }
public Map<Integer, ScoreDistribution> performSampling() { Map<Integer, ScoreDistribution> result = new HashMap<>(); for (int numTerms = options.getMinNumTerms(); numTerms <= options.getMaxNumTerms(); ++numTerms) { result.put(numTerms, performSamplingForTermCount(labels, numTerms)); } return result; }
SimilarityScoreSampling { public Map<Integer, ScoreDistribution> performSampling() { Map<Integer, ScoreDistribution> result = new HashMap<>(); for (int numTerms = options.getMinNumTerms(); numTerms <= options.getMaxNumTerms(); ++numTerms) { result.put(numTerms, performSamplingForTermCount(labels, numTerms)); } return result; } }
SimilarityScoreSampling { public Map<Integer, ScoreDistribution> performSampling() { Map<Integer, ScoreDistribution> result = new HashMap<>(); for (int numTerms = options.getMinNumTerms(); numTerms <= options.getMaxNumTerms(); ++numTerms) { result.put(numTerms, performSamplingForTermCount(labels, numTerms)); } return result; } SimilarityScoreSampling(Ontology ontology, Similarity similarity, ScoreSamplingOptions options, Map<TermId, ? extends Collection<TermId>> labels); }
SimilarityScoreSampling { public Map<Integer, ScoreDistribution> performSampling() { Map<Integer, ScoreDistribution> result = new HashMap<>(); for (int numTerms = options.getMinNumTerms(); numTerms <= options.getMaxNumTerms(); ++numTerms) { result.put(numTerms, performSamplingForTermCount(labels, numTerms)); } return result; } SimilarityScoreSampling(Ontology ontology, Similarity similarity, ScoreSamplingOptions options, Map<TermId, ? extends Collection<TermId>> labels); Map<Integer, ScoreDistribution> performSampling(); ScoreDistribution performSamplingForTermCount(Map<TermId, ? extends Collection<TermId>> labels, int numTerms); }
SimilarityScoreSampling { public Map<Integer, ScoreDistribution> performSampling() { Map<Integer, ScoreDistribution> result = new HashMap<>(); for (int numTerms = options.getMinNumTerms(); numTerms <= options.getMaxNumTerms(); ++numTerms) { result.put(numTerms, performSamplingForTermCount(labels, numTerms)); } return result; } SimilarityScoreSampling(Ontology ontology, Similarity similarity, ScoreSamplingOptions options, Map<TermId, ? extends Collection<TermId>> labels); Map<Integer, ScoreDistribution> performSampling(); ScoreDistribution performSamplingForTermCount(Map<TermId, ? extends Collection<TermId>> labels, int numTerms);  }