ngram for ngram in ngrams_ if all(w.pos_ in include_pos for w in ngram)
)
if exclude_pos:
exclude_pos = {pos.upper() for pos in utils.to_collection(exclude_pos, str, set)}
ngrams_ = (
ngram
for ngram in ngrams_
After Change
if filter_nums is True:
ngrams_ = (ngram for ngram in ngrams_ if not any(w.like_num for w in ngram))
if include_pos:
include_pos = cast(Set[str], utils.to_collection(include_pos, str, set))
include_pos = {pos.upper() for pos in include_pos}
ngrams_ = (
ngram for ngram in ngrams_ if all(w.pos_ in include_pos for w in ngram)
)
if exclude_pos:
exclude_pos = cast(Set[str], utils.to_collection(exclude_pos, str, set))
exclude_pos = {pos.upper() for pos in exclude_pos}
ngrams_ = (
ngram
for ngram in ngrams_