Convert YAML to segments and back