An interpolation method to characterize domains of generators of semigroups