Text this: A State Space Approach to Canonical Factorization with Applications