def get_top_segmentations(table, n):
    """
    Parameters
    ----------
    table : matrix of probabilities
        Each cell (i, j) of `table` gives the probability that i and j are in
        the same symbol.
    n : int
        Number of best segmentations which get returned
    """
    stroke_count = list(range(len(table)))
    topf = TopFinder(n)
    for curr_segmentation in all_segmentations(stroke_count):
        curr_seg_score = score_segmentation(curr_segmentation, table)
        topf.push(curr_segmentation, curr_seg_score)

    for el, score in topf:
        yield [normalize_segmentation(el), score]