generalize to calculate top n best segmentations