code: private static double calculateScore(
        Map<String, Integer> inputStringTokens, Map<String, Integer> ontologyTermTokens) {
      if (inputStringTokens.size() == 0 || ontologyTermTokens.size() == 0) return (double) 0;
      int totalToken = getTotalNumTokens(inputStringTokens) + getTotalNumTokens(ontologyTermTokens);
      int numMatchedToken = 0;
  
      for (Entry<String, Integer> token : inputStringTokens.entrySet()) {
        if (ontologyTermTokens.containsKey(token.getKey())) {
          numMatchedToken += Math.min(token.getValue(), ontologyTermTokens.get(token.getKey()));
        }
      }
  
      if (totalToken == 0) {
        return 0;
      } else {
        return 2.0 * numMatchedToken / totalToken * 100;
      }
    }
docs: Calculate the ngram distance