Extracts a bag-of-words from each document in a corpus serially.

    Inputs: - corpus: A python list of python strings. Each string is a document.
            - lemmatizing: A string containing one of the following: "porter", "snowball" or "wordnet".

    Output: - list_of_bags_of_words: A list of python dictionaries representing bags-of-words.
            - lemma_to_keywordbag_total: Aggregated python dictionary that maps stems/lemmas to original topic keywords.

def clean_corpus_serial(corpus, lemmatizing="wordnet"):
    """
    Extracts a bag-of-words from each document in a corpus serially.

    Inputs: - corpus: A python list of python strings. Each string is a document.
            - lemmatizing: A string containing one of the following: "porter", "snowball" or "wordnet".

    Output: - list_of_bags_of_words: A list of python dictionaries representing bags-of-words.
            - lemma_to_keywordbag_total: Aggregated python dictionary that maps stems/lemmas to original topic keywords.
    """
    list_of_bags_of_words = list()
    append_bag_of_words = list_of_bags_of_words.append

    lemma_to_keywordbag_total = defaultdict(lambda: defaultdict(int))

    for document in corpus:
        word_list, lemma_to_keywordbag = clean_document(document=document, lemmatizing=lemmatizing)  # TODO: Alter this.
        bag_of_words = combine_word_list(word_list)
        append_bag_of_words(bag_of_words)

        for lemma, keywordbag in lemma_to_keywordbag.items():
            for keyword, multiplicity in keywordbag.items():
                lemma_to_keywordbag_total[lemma][keyword] += multiplicity

    return list_of_bags_of_words, lemma_to_keywordbag_total