def calc_bayes_prob(words_prob_dict):
    """
    Calculate bayes probability, P(s|w)
    Args:
        words_prob_dict: the dictionary of the most max-N probability

    Returns: bayes probability

    """
    prob_sw = 1
    prob_sn = 1

    for word, prob in words_prob_dict.items():
        prob_sw *= (prob)
        prob_sn *= (1 - prob)

    p = prob_sw / (prob_sw + prob_sn)
    return p