def word2idx(sents, word2idx):
    return [[(word2idx[w] if (w in word2idx) else UNK) for w in s] for s in sents]
def word2idx(sents, word2idx):
    return [[(word2idx[w] if (w in word2idx) else UNK) for w in s] for s in sents]