Exemplo n.º 1
0
def fill_zrm(item: CharPhoneTable, transformer: Dict[str,
                                                     str]) -> CharPhoneTable:
    sy = split_sy(item.full)
    if sy[0] not in transformer or sy[1] not in transformer:
        raise RuntimeError(f"{sy} not in transformer")
    item.zrm = transformer[sy[0]] + transformer[sy[1]]
    return item
Exemplo n.º 2
0
def fill_zrm(item: CharPhoneTable,
             transformer: Dict[str, str]) -> Tuple[CharPhoneTable, bool]:
    sy = split_sy(item.full)
    if sy[0] not in transformer or sy[1] not in transformer:
        print(f"{sy} not in transformer", file=sys.stderr)
        return item, False
    item.zrm = transformer[sy[0]] + transformer[sy[1]]
    return item, True