from typing import List
from typing import Dict


def process_tokens(
    tokens: List[str], token2idx: Dict[str, int], unk: str = "<UNK>"
) -> List[int]:
    """
    Transform list of tokens into list of tokens' indices.
    """

    processed_tokens = [token2idx.get(token, token2idx[unk]) for token in tokens]
    return processed_tokens