def extract_features(document, word_features):
    """
    Used to get a word vector required by the naive bayes classifier for training and during streaming
    :param document: tokens
    :param word_features: all words
    :return:
    """
    document_words = set(document)
    features = []
    for word in word_features:
        features.append(word in document_words)
    return features