Keep unique values in Core Data

I’m trying to figure out a way of keeping unique words. I have objects stored in core data (like different persons), each object has a string attribute (a list of words). How to only keep unique words in all the objects together?

Example:

(Object person A: attribute clothes: red blue) (Object person B: attribute clothes: red black) -> (Object person A: attribute clothes: red blue) (Object person B: attribute clothes: black)

in python I would have loaded text files and used groupy or a set