public function discretizeTimeSeries( array $pTimeSeries, $pFeatureWindowLength = 1 ) {
        $nrOfBreakpoints = $this->alphabetSize - 1;
        $breakpoints     = $this->breakpoints[$nrOfBreakpoints];

        $saxWord         = "";

        // discretize reference time series
        for ( $i=0; $i < count( $pTimeSeries ); $i+=$pFeatureWindowLength ) { 
            $datapoint = $pTimeSeries[$i]['count'];

            // dimensionality reduction using mean
            for ( $j=$i+1; $j < $pFeatureWindowLength; $j++ ) { 
                $datapoint += $pTimeSeries[$j]['count'];
            }
            $datapoint /= $pFeatureWindowLength;

            // discretize to sax word using breakpoints        
            for ( $z=0; $z < $nrOfBreakpoints + 1; $z++ ) {
                if ( isset( $breakpoints[$z] ) && $datapoint < $breakpoints[$z] ) {
                    // found first matching interval 
                    $saxWord .= $this->alphabet[$z];
                    break;
                } elseif ( $z === $nrOfBreakpoints ) {
                    // last datapoint, is greater than the last breakpoint
                    $saxWord .= $this->alphabet[$z];
                }
            }
        }

        return $saxWord;
    }