We present an algorithm which for any aperiodic and primitivesubstitution outputs a finite representation ofeach special word in the shift space associated to that substitution, and determines when suchrepresentations are equivalent under orbit and shift tail equivalence. Thealgorithm has been implemented and applied in the study of certainnew invariants for flow equivalence of substitutional dynamical systems.