dictionary: support filtering a dictionary

This adds a -f/--filter-words option that generates a new dictionary
containing words from the specified dictionary that are in the
specified document(s).