def get_shared_vocab(vocab1, vocab2):
    """Return intersection of two vocabs."""
    shared_words = set(word for word in vocab1 if word in vocab2)
    return {word: idx for idx, word in enumerate(shared_words)}