def fix_diff_s_same_y_full(item: CharPhoneTable) -> CharPhoneTable: full_sy = split_sy(item.full) correct_s = item.phones[0] if correct_s == "u": correct_s = "sh" elif correct_s == "i": correct_s = "ch" elif correct_s == "v": correct_s = "zh" item.full = correct_s + full_sy[1] return item
def fix_full_from_xhe( item: CharPhoneTable, transformer: Dict[str, List[str]]) -> Tuple[CharPhoneTable, bool]: xhe = item.phones if xhe[1] in 'ivu': y = xhe[1] elif xhe[1] in transformer: y = transformer[xhe[1]][0] else: return item, False if xhe[0] == "i": s = "ch" elif xhe[0] == "u": s = "sh" elif xhe[0] == "v": s = "zh" else: s = xhe[0] item.full = s + y return item, True
def update_full(item: CharPhoneTable, full: str) -> CharPhoneTable: item.full = full return item