def baxter2ipa(mch, segmented=False):
out = mch<EOL>if out[-<NUM_LIT:1>] in '<STR_LIT>':<EOL><INDENT>out += '<STR_LIT:R>'<EOL><DEDENT>elif out[-<NUM_LIT:1>] not in '<STR_LIT>':<EOL><INDENT>out += '<STR_LIT:P>'<EOL><DEDENT>for s,t in _cd.GY['<STR_LIT>']: <EOL><INDENT>out = out.replace(s,t)<EOL><DEDENT>if segmented:<EOL><INDENT>return parse_chinese_morphemes(out) <EOL><DEDENT>return out<EOL>
Very simple aber convient-enough conversion from baxter MCH to IPA MCH.
this is also more or less already implemented in MiddleChinese