def generate_unigram_table(ngram):
    """Generates a frequency table for a unigram model"""
    ngram_table = dict()
    for token in ngram:
        if token in ngram_table: # If token is already present, add one to value
            ngram_table[token] = ngram_table[token] + 1
        else:
            ngram_table[token] = 1        # Add token if not present
    ngram_sum = sum(ngram_table.values()) # Sums the total occurrences of all tokens
    for k, v in ngram_table.items():
        ngram_table[k] = v/ngram_sum      # Changes frequency to probability
    return ngram_table