def filtered_words(words, mapping):
    """    Go through a sequence of words. Words occuring in mapping are replaced,
    others are passed on as-is.
    """
    for word in words:
        yield mapping.get(word, word)
