import re


def document_to_vector(lemmatized_document, uniques):
    """
    Converts a lemmatized document to a bow vector 
    representation.
    1/0 for word exists/doesn't exist
    """
    #print(uniques)
    # tokenize
    words = re.findall(r'\w+', lemmatized_document.lower())

    # vector = {} 
    vector = [0]*len(uniques)
    # list of the words is accessible via vector.keys()
    # list of 0/1 is accessible via vector.values() 

    # seen = []
    for i in range(len(uniques)):
        for j in range(len(words)):
            if uniques[i] == words[j]:
                vector[i] = 1
                continue

    return vector