Refactoring morphology parsing so we can use it in the API.