public function cluster(TrainingSet $documents, FeatureFactoryInterface $ff)
    {
        // what a complete waste of memory here ...
        // the same data exists in $documents, $docs and
        // the only useful parts are in $this->strategy
        $docs = $this->getDocumentArray($documents, $ff);
        $this->strategy->initializeStrategy($this->dist,$docs);
        unset($docs); // perhaps save some memory

        // start with all the documents being in their
        // own cluster we 'll merge later
        $clusters = range(0,count($documents)-1);
        $c = count($clusters);
        while ($c>1) {
            // ask the strategy which to merge. The strategy
            // will assume that we will indeed merge the returned clusters
            list($i,$j) = $this->strategy->getNextMerge();
            $clusters[$i] = array($clusters[$i],$clusters[$j]);
            unset($clusters[$j]);
            $c--;
        }
        $clusters = array($clusters[$i]);

        // return the dendrogram
        return array($clusters);
    }