def METHOD_NAME(hyp_uid_to_tra, score_fn):
    lm_score = 0.
    w_cnt = 0
    for hyp in hyp_uid_to_tra.values():
        cur_score = score_fn(hyp)
        cur_cnt = len(hyp.split()) + 1  # plus one for </s>
        lm_score += cur_score
        w_cnt += cur_cnt
        logger.debug((
            f"======================\n"
            f"score sum/avg = {cur_score:.2f}/{cur_score/cur_cnt:.2f}\n"
            f"hyp = {hyp}"
        ))
    lm_ppl = math.pow(10, -lm_score / w_cnt)
    logger.debug(f"lm ppl = {lm_ppl:.2f}; num. of words = {w_cnt}")
    return lm_ppl