from typing import List
from typing import Any
from typing import Dict


def get_results(
    model_output: List[Any], output_semantics: List[Any]
) -> List[Dict[str, Any]]:
    """
    Get the prediction with semantics.

    Parameters
    ----------
    model_output : List[Any]
        A list of probabilities
    output_semantics : List[Any]
        A list of semantics

    Returns
    -------
    A list of dictionaries which have probability and semantics as keys.
    """
    results = []
    for symbolnr, prob in enumerate(model_output):
        results.append(
            {
                "symbolnr": symbolnr,
                "probability": prob,
                "semantics": output_semantics[symbolnr],
            }
        )
    results = sorted(results, key=lambda x: x["probability"], reverse=True)
    return results