def format_tag_apertium(stuff): if len(stuff) == 0: return "" elif stuff in stuff2monodix: if stuff2monodix[stuff] in ['+', '-', '#', '0', '']: return stuff2monodix[stuff] elif stuff2monodix[stuff].startswith('+'): return (lexc_escape(stuff2monodix[stuff]) + '%>') else: return ('%<' + lexc_escape(stuff2monodix[stuff]) + '%>') else: fail_formatting_missing_for(stuff, "apertium") return ""
def format_monodix_s(stuff): s = '' if stuff in stuff2monodix: s += '<s n="' + stuff2monodix[stuff] + '"/>' else: fail_formatting_missing_for(stuff, "monodix") if '><' in s: s = s.replace('><', '"/><s n="') elif '"+"' in s: s = '+' elif '""' in s: s = '' elif '"-"' in s: s = '-' return s