Get the probability (or rather a score) of a hypothesis.

    Parameters
    ----------
    hypothesis : dict
        with keys 'segmentation', 'symbols', ...

    Returns
    -------
    float
        in [0.0, 1.0]

def _calc_hypothesis_probability(hypothesis):
    """
    Get the probability (or rather a score) of a hypothesis.

    Parameters
    ----------
    hypothesis : dict
        with keys 'segmentation', 'symbols', ...

    Returns
    -------
    float
        in [0.0, 1.0]
    """
    prob = 0.0
    for symbol, seg in zip(hypothesis['symbols'], hypothesis['segmentation']):
        # symbol_latex = symbol['symbol'].split(";")[1]
        # TODO: Does p_strokes really improve the system?
        prob += symbol['probability']  # * p_strokes(symbol_latex, len(seg))

    # Use language model to update probabilities
    pure_symbols = [symbol['symbol'].split(";")[1]
                    for symbol in hypothesis['symbols']]
    pure_symbols = ["<s>"] + pure_symbols + ["</s>"]
    lm_prob = language_model.get_probability(pure_symbols)
    hypothesis['lm_probability'] = 2**lm_prob
    return (prob * float(hypothesis['lm_probability']) *
            (1.0 / len(hypothesis['segmentation'])))