from typing import Dict


def _compute_metrics(hits_or_lcs: int, pred_len: int, target_len: int) -> Dict[str, float]:
    """This computes precision, recall and F1 score based on hits/lcs, and the length of lists of tokenizer
    predicted and target sentences.

    Args:
        hits_or_lcs:
            A number of matches or a length of the longest common subsequence.
        pred_len:
            A length of a tokenized predicted sentence.
        target_len:
            A length of a tokenized target sentence.
    """
    precision = hits_or_lcs / pred_len
    recall = hits_or_lcs / target_len
    if precision == recall == 0.0:
        return dict(precision=0.0, recall=0.0, fmeasure=0.0)

    fmeasure = 2 * precision * recall / (precision + recall)
    return dict(precision=precision, recall=recall, fmeasure=fmeasure)