class TermOverlapSimilarity implements Similarity {

  @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 overlap = Sets.intersection(termIdsQuery, termIdsTarget).size();
    if (!normalized) {
      return overlap;
    } else {
      return overlap / Math.min(termIdsQuery.size(), termIdsTarget.size());
    }
  }

  public  TermOverlapSimilarity(Ontology ontology);
  public  TermOverlapSimilarity(Ontology ontology, boolean normalized);

}