from typing import Dict
from typing import List


def coverage_per_language(predictions: Dict[str, List[str]],
                          relevance_scores: Dict[str, Dict[str, float]], with_positive_relevance: bool=False) -> float:
    """
    Compute the % of annotated URLs that appear in the algorithm's predictions.
    """
    num_annotations = 0
    num_covered = 0
    for query, url_data in relevance_scores.items():
        urls_in_predictions = set(predictions[query])
        for url, relevance in url_data.items():
            if not with_positive_relevance or relevance > 0:
                num_annotations += 1
                if url in urls_in_predictions:
                    num_covered += 1

    return num_covered / num_annotations