How to filter duplicate outputs?

I’m using claude api to generate topics. Unfortunately the outputs are always revolving around the same topic with one or two words different. Is there a way to filter out duplicate outputs and abandon them?