Is it possible to constraint text generation?

I was interested in the possibility of generating text that not uses specific phrases. By a phrase, I mean a sequence of tokens that can鈥檛 be together in that specific order. I wrote a constraint that suits my requirement: constraint/constraint.py at main 路 Saninsusanin/constraint 路 GitHub.
But it works too slow. Is there a better way to do this? Thanks :hugs: