from typing import List
from typing import Callable


def inverse_qid_cand_with_score(value: List[int], itos: Callable[[int], str]):
    """Return entity candidate and prob score from numerical values."""
    assert len(value) % 2 == 0
    new_value = []
    for i in range(0, len(value), 2):
        # -1 values are only added at the end as padding
        if value[i] == -1:
            break
        new_value.append([itos(value[i]), value[i + 1]])
    return new_value