code: public static GrammarRules performPruning(double[] ts, GrammarRules grammarRules) {
      RulePruningAlgorithm pruner = new RulePruningAlgorithm(grammarRules, ts.length);
      pruner.pruneRules();
      return pruner.regularizePrunedRules();
    }
docs: Performs pruning.
  
  @param ts the input time series.
  @param grammarRules the grammar.
  @return pruned ruleset.