Convert an accented Pinyin vowel to a numbered Pinyin vowel.
196861
def _accented_vowel_to_numbered(vowel):
    """"""
    for numbered_vowel, accented_vowel in _PINYIN_TONES.items():
        if vowel == accented_vowel:
            return tuple(numbered_vowel)
1077644
def add_accent(components, accent):
    
    vowel = components[1]
    last_consonant = components[2]
    if accent == Accent.NONE:
        vowel = remove_accent_string(vowel)
        return [components[0], vowel, last_consonant]

    if vowel == "":
        return components
    #raw_string is a list, not a str object
    raw_string = remove_accent_string(vowel).lower()
    new_vowel = ""
    # Highest priority for ê and ơ
    index = max(raw_string.find("ê"), raw_string.find("ơ"))
    if index != -1:
        new_vowel = vowel[:index] + add_accent_char(vowel[index], accent) + vowel[index+1:]
    elif len(vowel) == 1 or (len(vowel) == 2 and last_consonant == ""):
        new_vowel = add_accent_char(vowel[0], accent) + vowel[1:]
    else:
        new_vowel = vowel[:1] + add_accent_char(vowel[1], accent) + vowel[2:]
    return [components[0], new_vowel, components[2]]
1066707
function(str) {
            
            var accent = [
                /[\300-\306]/g, /[\340-\346]/g, // A, a
                /[\310-\313]/g, /[\350-\353]/g, // E, e
                /[\314-\317]/g, /[\354-\357]/g, // I, i
                /[\322-\330]/g, /[\362-\370]/g, // O, o
                /[\331-\334]/g, /[\371-\374]/g, // U, u
                /[\321]/g, /[\361]/g, // N, n
                /[\307]/g, /[\347]/g // C, c
            ];
            
            var noaccent = ['A','a','E','e','I','i','O','o','U','u','N','n','C','c'];
            
            for(var i = 0; i < accent.length; i++) str = str.replace(accent[i], noaccent[i]);
            
            return str;
        }
1326215
def decode(s):
    

    s = s.lower()
    r = ""
    t = ""
    for c in s:
        if c >= 'a' and c <= 'z':
            t += c
        elif c == ':':
            try:
                if t[-1] == 'u':
                    t = t[:-1] + u"\u00fc"
            except:
                pass
        else:
            if c >= '0' and c <= '5':
                tone = int(c) % 5
                if tone != 0:
                    m = re.search(u"[aoeiuv\u00fc]+", t)
                    if m is None:
                        t += c
                    elif len(m.group(0)) == 1:
                        t = t[:m.start(0)] + PinyinToneMark[tone][PinyinToneMark[0].index(m.group(0))] + t[m.end(0):]
                    else:
                        if 'a' in t:
                            t = t.replace("a", PinyinToneMark[tone][0])
                        elif 'o' in t:
                            t = t.replace("o", PinyinToneMark[tone][1])
                        elif 'e' in t:
                            t = t.replace("e", PinyinToneMark[tone][2])
                        elif t.endswith("ui"):
                            t = t.replace("i", PinyinToneMark[tone][3])
                        elif t.endswith("iu"):
                            t = t.replace("u", PinyinToneMark[tone][4])
                        else:
                            t += "!"
            r += t
            t = ""
    r += t
    return r
997646
def text_to_char_array(original, alphabet):
    
    """
    return np.asarray([alphabet.label_from_string(c) for c in original])
1017442
def convert_uei(pinyin):
    
    return UI_RE.sub(lambda m: m.group(1) + UI_MAP[m.group(2)], pinyin)
92602
def pinyin_to_zhuyin(s):
    
    return _convert(s, zhon.pinyin.syllable, pinyin_syllable_to_zhuyin,
                    remove_apostrophes=True, separate_syllables=True)
1253422
def str_to_num(self, arg):
        

        if len(arg) == 1:
            ten = '10'
        else:
            ten = ''
        switcher = {
            '一': '1',
            '二': '2',
            '三': '3',
            '四': '4',
            '五': '5',
            '六': '6',
            '七': '7',
            '八': '8',
            '九': '9',
            '十': ten,
            '〇': '0',
            '○': '0',
        }
        test = ''
        for i in arg:
            test = test + switcher.get(i, None)
        return int(test)
396520
def get_mark_char(char):
    
    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
1157732
def _vowelinstem(self, stem):
        """"""
        for i in range(len(stem)):
            if not self._cons(stem, i):
                return True
        return False
26652
public static List<String> convertPinyinList2TonePinyinList(List<Pinyin> pinyinList)
    {
        List<String> tonePinyinList = new ArrayList<String>(pinyinList.size());
        for (Pinyin pinyin : pinyinList)
        {
            tonePinyinList.add(pinyin.getPinyinWithToneMark());
        }

        return tonePinyinList;
    }
1077548
def convert_uv(pinyin):
    
    return UV_RE.sub(
        lambda m: ''.join((m.group(1), UV_MAP[m.group(2)], m.group(3))),
        pinyin)
841456
def get(s, delimiter='', format="diacritical"):
    
    return delimiter.join(_pinyin_generator(u(s), format=format))
504929
def vowelinstem(self):
        """"""
        for i in range(self.k0, self.j + 1):
            if not self.cons(i):
                return 1
        return 0
567095
def remove_accent_string(string):
    
    return utils.join([add_accent_char(c, Accent.NONE) for c in string])
1137049
public static String convertToPinyinString(String text, String separator, boolean remainNone)
    {
        List<Pinyin> pinyinList = PinyinDictionary.convertToPinyin(text, true);
        int length = pinyinList.size();
        StringBuilder sb = new StringBuilder(length * (5 + separator.length()));
        int i = 1;
        for (Pinyin pinyin : pinyinList)
        {

            if (pinyin == Pinyin.none5 && !remainNone)
            {
                sb.append(text.charAt(i - 1));
            }
            else sb.append(pinyin.getPinyinWithoutTone());
            if (i < length)
            {
                sb.append(separator);
            }
            ++i;
        }
        return sb.toString();
    }
251212
def convert_iou(pinyin):
    
    return IU_RE.sub(lambda m: m.group(1) + IU_MAP[m.group(2)], pinyin)