'Examples
>>> from sympy.combinatorics.free_groups import free_group
>>> F, x, y, z = free_group("x, y, z")
>>> (x**2*y**-1).contains_generators()
{x, y}
>>> (x**3*z).contains_generators()
{x, z}'

def contains_generators(self):

    group = self.group
    gens = set()
    for syllable in self.array_form:
        gens.add(group.dtype(((syllable[0], 1),)))
    return set(gens)
