def build_vocab(corpus):
    vocab = set()
    for sent in corpus:
        vocab.update(set(sent))
    vocab = (list(vocab) + [UNK_TOKEN])
    word2idx = {word: idx for (idx, word) in enumerate(vocab)}
    idx2word = {idx: word for (idx, word) in enumerate(vocab)}
    return (vocab, word2idx, idx2word)
def build_vocab(corpus):
    vocab = set()
    for sent in corpus:
        vocab.update(set(sent))
    vocab = (list(vocab) + [UNK_TOKEN])
    word2idx = {word: idx for (idx, word) in enumerate(vocab)}
    idx2word = {idx: word for (idx, word) in enumerate(vocab)}
    return (vocab, word2idx, idx2word)