def translate_tokens(tokens, d):
    """ Produce set of translated tokens, returns number of tokens that
    were translated. All possible translations of a token are added. """
    n_translated = 0
    translated = set()
    for w in tokens:
        if w not in d:
            continue
        translated.update(d[w])
        n_translated += 1
    return n_translated, translated