code: public static ArrayList<SameLengthMotifs> performPruning(double[] ts, GrammarRules grammarRules,
        double thresholdLength, double thresholdCom, double fractionTopDist) {
  
      RuleOrganizer ro = new RuleOrganizer();
  
      ArrayList<SameLengthMotifs> allClassifiedMotifs = ro.classifyMotifs(thresholdLength,
          grammarRules);
  
      allClassifiedMotifs = ro.removeOverlappingInSimiliar(allClassifiedMotifs, grammarRules, ts,
          thresholdCom);
  
      ArrayList<SameLengthMotifs> newAllClassifiedMotifs = ro.refinePatternsByClustering(grammarRules,
          ts, allClassifiedMotifs, fractionTopDist);
  
      return newAllClassifiedMotifs;
    }
docs: Performs clustering.
  
  @param ts the input time series.
  @param grammarRules the grammar.
  @param thresholdLength a parameter.
  @param thresholdCom another parameter.
  @param fractionTopDist yet another parameter.
  
  @return pruned ruleset.