def create_vocab(docs):
    """Create a vocabulary for a given set of documents"""
    words = set()
    for d in docs:
        for w in d:
            words.add(w)
    vocab = {}
    for i, w in enumerate(list(words)):
        vocab[w] = i
    return vocab