def gen_words(corpus):
    """Yields each word from the given corpus, must be an iterator over lines
    of strings.
    """
    for line in corpus:
        for word in line.strip().split():
            yield word
