def thai_to_eng ( text : str ) -> str : return "" . join ( [ TH_EN_KEYB_PAIRS [ ch ] if ( ch in TH_EN_KEYB_PAIRS ) else ch for ch in text ] )
python how to detect english words
Correct text in one language that is incorrectly - typed with a keyboard layout in another language . ( type Thai with English keyboard )
def thai_to_eng(text: str) -> str:
    """
    Correct text in one language that is incorrectly-typed with a keyboard layout in another language. (type Thai with English keyboard)

    :param str text: Incorrect input (type English with Thai keyboard)
    :return: English text
    """
    return "".join(
        [TH_EN_KEYB_PAIRS[ch] if (ch in TH_EN_KEYB_PAIRS) else ch for ch in text]
    )