def _extract_words_users(history):
    """Returns the set of words and the set of users in the dataset
    """
    vocabulary = set()
    users = set()
    for t, doc, u, q in history:
        for word in doc.split():
            vocabulary.add(word)
            users.add(u)
    return vocabulary, users