gensim.corpora.Dictionary.filter_tokens

Dictionary.filter_tokens(bad_ids=None, good_ids=None)[source]

Remove the selected bad_ids tokens from all dictionary mappings, or, keep selected good_ids in the mapping and remove the rest.

bad_ids and good_ids are collections of word ids to be removed.