code: public static double shinglerSimilarity(String text1, String text2, int w) {
          preprocessDocument(text1);
          preprocessDocument(text2);
  
          NgramsExtractor.Parameters parameters = new NgramsExtractor.Parameters();
          parameters.setMaxCombinations(w);
          parameters.setMaxDistanceBetweenKwds(0);
          parameters.setExaminationWindowLength(w);
  
          NgramsExtractor ngrams = new NgramsExtractor(parameters);
  
          
          Map<String, Double> keywords1 = ngrams.extract(text1);
          Map<String, Double> keywords2 = ngrams.extract(text2);
          
          //remove all the other combinations except of the w-grams
          filterKeywordCombinations(keywords1, w); 
          filterKeywordCombinations(keywords2, w);
          
          //ngrams=null;
          //parameters=null;
          
          double totalKeywords=0.0;
          double commonKeywords=0.0;
          
          Set<String> union = new HashSet<>(keywords1.keySet());
          union.addAll(keywords2.keySet());
          totalKeywords+=union.size();
          //union=null;
  
  
          Set<String> intersect = new HashSet<>(keywords1.keySet());
          intersect.retainAll(keywords2.keySet());
          commonKeywords+=intersect.size();
          //intersect=null;
          
          double resemblance=commonKeywords/totalKeywords;
  
          //keywords1=null;
          //keywords2=null;
  
          return resemblance;
      }
docs: Estimates the w-shingler similarity between two texts. The w is the number
  of word sequences that are used for the estimation.
  
  References:
  http://phpir.com/shingling-near-duplicate-detection
  http://www.std.org/~msm/common/clustering.html
  
  @param text1
  @param text2
  @param w
  @return