def compute_struc_matching_score(matching_struc, idf_values):
    """
    Computes the structural matching score.

    Args:
        matching_struc: Set of structural features that exists in both query
        and related formula.
        idf_values: Map of formula term and its IDF score.

    Returns:
        The structural matching score.
    """
    struc_score = 0
    for term in matching_struc:
        if term in idf_values:
            struc_score += idf_values.get(term)

    return struc_score