code: public Map<String, Integer> ts2Shingles(double[] series, int windowSize, int paaSize,
        int alphabetSize, NumerosityReductionStrategy strategy, double nrThreshold, int shingleSize)
        throws SAXException {
  
      // build all shingles
      String[] alphabet = new String[alphabetSize];
      for (int i = 0; i < alphabetSize; i++) {
        alphabet[i] = String.valueOf(TSProcessor.ALPHABET[i]);
      }
      String[] allShingles = getAllPermutations(alphabet, shingleSize);
  
      // result
      HashMap<String, Integer> res = new HashMap<String, Integer>(allShingles.length);
      for (String s : allShingles) {
        res.put(s, 0);
      }
  
      // discretize
      SAXRecords saxData = ts2saxViaWindow(series, windowSize, paaSize, na.getCuts(alphabetSize),
          strategy, nrThreshold);
  
      // fill in the counts
      for (SAXRecord sr : saxData) {
        String word = String.valueOf(sr.getPayload());
        int frequency = sr.getIndexes().size();
        for (int i = 0; i <= word.length() - shingleSize; i++) {
          String shingle = word.substring(i, i + shingleSize);
          res.put(shingle, res.get(shingle) + frequency);
        }
      }
  
      return res;
    }
docs: Converts a single time-series into map of shingle frequencies.
  
  @param series the time series.
  @param windowSize the sliding window size.
  @param paaSize the PAA segments number.
  @param alphabetSize the alphabet size.
  @param strategy the numerosity reduction strategy.
  @param nrThreshold the SAX normalization threshold.
  @param shingleSize the shingle size.
  
  @return map of shingle frequencies.
  @throws SAXException if error occurs.