test_class.declarator: similarity = new JaccardSimilarity(ontology)
test_class.modifier: private final
test_class.original_string: private final JaccardSimilarity similarity = new JaccardSimilarity(ontology);
test_class.type: JaccardSimilarity
test_class.var_name: similarity
test_class.file: phenol-core/src/test/java/org/monarchinitiative/phenol/ontology/similarity/JaccardSimilarityTest.java
test_class.identifier: JaccardSimilarityTest
test_class.superclass: extends VegetableOntologyTestBase
test_case.body: @Test
    void testComputeSimilarities() {
      assertEquals(
          0.25,
          similarity.computeScore(Lists.newArrayList(idBeet), Lists.newArrayList(idCarrot)),
          0.01);
      assertEquals(
          0.66,
          similarity.computeScore(Lists.newArrayList(idBlueCarrot), Lists.newArrayList(idCarrot)),
          0.01);
      assertEquals(
          0.33,
          similarity.computeScore(Lists.newArrayList(idPumpkin), Lists.newArrayList(idCarrot)),
          0.01);
      assertEquals(
          0.0,
          similarity.computeScore(Lists.newArrayList(idLeafVegetable), Lists.newArrayList(idCarrot)),
          0.01);
    }
test_case.class_method_signature: JaccardSimilarityTest.testComputeSimilarities()
test_case.full_signature: @Test void testComputeSimilarities()
test_case.identifier: testComputeSimilarities
test_case.invocations: assertEquals computeScore newArrayList newArrayList assertEquals computeScore newArrayList newArrayList assertEquals computeScore newArrayList newArrayList assertEquals computeScore newArrayList newArrayList
test_case.modifiers: @Test
test_case.parameters: ()
test_case.return: void
test_case.signature: void testComputeSimilarities()
focal_class.declarator: ontology
focal_class.modifier: private final
focal_class.original_string: private final Ontology ontology;
focal_class.type: Ontology
focal_class.var_name: ontology
focal_class.declarator: normalized
focal_class.modifier: private final
focal_class.original_string: private final boolean normalized;
focal_class.type: boolean
focal_class.var_name: normalized
focal_class.file: phenol-core/src/main/java/org/monarchinitiative/phenol/ontology/similarity/JaccardSimilarity.java
focal_class.identifier: JaccardSimilarity
focal_class.interfaces: implements Similarity
focal_class.class_method_signature: JaccardSimilarity.JaccardSimilarity(Ontology ontology)
focal_class.full_signature: public  JaccardSimilarity(Ontology ontology)
focal_class.identifier: JaccardSimilarity
focal_class.modifiers: public
focal_class.parameters: (Ontology ontology)
focal_class.signature:  JaccardSimilarity(Ontology ontology)
focal_class.class_method_signature: JaccardSimilarity.JaccardSimilarity(Ontology ontology, boolean normalized)
focal_class.full_signature: public  JaccardSimilarity(Ontology ontology, boolean normalized)
focal_class.identifier: JaccardSimilarity
focal_class.modifiers: public
focal_class.parameters: (Ontology ontology, boolean normalized)
focal_class.signature:  JaccardSimilarity(Ontology ontology, boolean normalized)
focal_class.class_method_signature: JaccardSimilarity.getName()
focal_class.full_signature: @Override public String getName()
focal_class.identifier: getName
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getName()
focal_class.class_method_signature: JaccardSimilarity.getParameters()
focal_class.full_signature: @Override public String getParameters()
focal_class.identifier: getParameters
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getParameters()
focal_class.class_method_signature: JaccardSimilarity.isSymmetric()
focal_class.full_signature: @Override public boolean isSymmetric()
focal_class.identifier: isSymmetric
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isSymmetric()
focal_class.class_method_signature: JaccardSimilarity.computeScore(Collection<TermId> query, Collection<TermId> target)
focal_class.full_signature: @Override public double computeScore(Collection<TermId> query, Collection<TermId> target)
focal_class.identifier: computeScore
focal_class.modifiers: @Override public
focal_class.parameters: (Collection<TermId> query, Collection<TermId> target)
focal_class.return: double
focal_class.signature: double computeScore(Collection<TermId> query, Collection<TermId> target)
focal_method.body: @Override
    public double computeScore(Collection<TermId> query, Collection<TermId> target) {
      final Set<TermId> termIdsQuery = ontology.getAllAncestorTermIds(query, false);
      final Set<TermId> termIdsTarget = ontology.getAllAncestorTermIds(target, false);
  
      double intersectionSize = Sets.intersection(termIdsQuery, termIdsTarget).size();
      if (normalized) {
        return intersectionSize / Sets.union(termIdsQuery, termIdsTarget).size();
      } else {
        return intersectionSize;
      }
    }
focal_method.class_method_signature: JaccardSimilarity.computeScore(Collection<TermId> query, Collection<TermId> target)
focal_method.full_signature: @Override public double computeScore(Collection<TermId> query, Collection<TermId> target)
focal_method.identifier: computeScore
focal_method.invocations: getAllAncestorTermIds getAllAncestorTermIds size intersection size union
focal_method.modifiers: @Override public
focal_method.parameters: (Collection<TermId> query, Collection<TermId> target)
focal_method.return: double
focal_method.signature: double computeScore(Collection<TermId> query, Collection<TermId> target)