示例#1
0
 def atomic_check(action):
     """
     Check if the `action` created one of the marks, accents, or characters
     in `comps`.
     """
     return (action[0] == _Action.ADD_ACCENT and action[1] in accent_list) \
             or (action[0] == _Action.ADD_MARK and action[1] in mark_list) \
             or (action[0] == _Action.ADD_CHAR and action[1] == \
                 accent.remove_accent_char(comps[1][-1]))  # ơ, ư
示例#2
0
 def atomic_check(action):
     """
     Check if the `action` created one of the marks, accents, or characters
     in `comps`.
     """
     return (action[0] == _Action.ADD_ACCENT and action[1] in accent_list) \
             or (action[0] == _Action.ADD_MARK and action[1] in mark_list) \
             or (action[0] == _Action.ADD_CHAR and action[1] == \
                 accent.remove_accent_char(comps[1][-1]))  # ơ, ư
示例#3
0
def get_mark_char(char):
    """
    Get the mark of a single char, if any.
    """
    char = accent.remove_accent_char(char.lower())
    if char == "":
        return Mark.NONE
    if char == "đ":
        return Mark.BAR
    if char in "ă":
        return Mark.BREVE
    if char in "ơư":
        return Mark.HORN
    if char in "âêô":
        return Mark.HAT
    return Mark.NONE