from typing import List
from typing import Dict


def compute_gap_nominator(
    ranked_candidates: List[str],
    gold2weight: Dict[str, int],
) -> float:
    """
    Method for computing nominator for GAP score.

    Args:
        ranked_candidates: List of ranked candidates.
        gold2weight: Dictionary that maps gold word to its annotators number.
    Returns:
        nominator: computed nominator of GAP score.
    """
    cumsum = 0.0
    nominator = 0.0
    for rank, word in enumerate(ranked_candidates):
        weight = gold2weight.get(word, 0)
        if weight:
            cumsum += weight
            nominator += cumsum / (rank+1)
    return nominator