code: public static float calculate(Map<String, Integer> features1, Map<String, Integer> features2) {
          TreeSet<String> keys = new TreeSet<String>(features1.keySet());
          keys.addAll(features2.keySet());
  
          float sum = 0.0f;
          for (String key : keys) {
              Integer c1 = features1.get(key);
              Integer c2 = features2.get(key);
  
              c1 = c1 == null ? 0 : c1;
              c2 = c2 == null ? 0 : c2;
              sum += 1.0 - Math.abs(c1 - c2) / (c1 + c2);
          }
  
          return sum / keys.size();
      }
docs: Evaluate the LINGO similarity between two key,value sty;e fingerprints.
  
  The value will range from 0.0 to 1.0.
  
  @param features1
  @param features2
  @return similarity