Return a list of syllables that contain a dipthong

        :param syllables:
        :return:
8581
def flag_dipthongs(self, syllables: List[str]) -> List[int]:
        
        long_positions = []
        for idx, syl in enumerate(syllables):
            for dipthong in self.constants.DIPTHONGS:
                if dipthong in syllables[idx]:
                    if not string_utils.starts_with_qu(syllables[idx]):
                        long_positions.append(idx)
        return long_positions
1143122
def get_words(self, include_freq=False, on_unicode_error='strict'):
        
        pair = self.f.getVocab(on_unicode_error)
        if include_freq:
            return (pair[0], np.array(pair[1]))
        else:
            return pair[0]
669323
def _parse_numbered_syllable(unparsed_syllable):
    """"""
    tone_number = unparsed_syllable[-1]
    if not tone_number.isdigit():
        syllable, tone = unparsed_syllable, '5'
    elif tone_number == '0':
        syllable, tone = unparsed_syllable[:-1], '5'
    elif tone_number in '12345':
        syllable, tone = unparsed_syllable[:-1], tone_number
    else:
        raise ValueError("Invalid syllable: %s" % unparsed_syllable)
    return syllable, tone
1157865
def apply_T4(word):
    ''''''
    T4 = ''
    WORD = word.split('.')

    for i, v in enumerate(WORD):

        # i % 2 != 0 prevents this rule from applying to first, third, etc.
        # syllables, which receive stress (WSP)
        if is_consonant(v[-1]) and i % 2 != 0:

            if i + 1 == len(WORD) or is_consonant(WORD[i + 1][0]):

                if contains_Vu_diphthong(v):
                    I = v.rfind('u')
                    WORD[i] = v[:I] + '.' + v[I:]
                    T4 = ' T4'

                elif contains_Vy_diphthong(v):
                    I = v.rfind('y')
                    WORD[i] = v[:I] + '.' + v[I:]
                    T4 = ' T4'

    word = '.'.join(WORD)

    return word, T4
407318
def _adjustSyllabification(adjustedPhoneList, syllableList):
    '''
    
    '''
    i = 0
    retSyllableList = []
    for syllableNum, syllable in enumerate(syllableList):
        j = len(syllable)
        if syllableNum == len(syllableList) - 1:
            j = len(adjustedPhoneList) - i
        tmpPhoneList = adjustedPhoneList[i:i + j]
        numBlanks = -1
        phoneList = tmpPhoneList[:]
        while numBlanks != 0:
            
            numBlanks = tmpPhoneList.count(u"''")
            if numBlanks > 0:
                tmpPhoneList = adjustedPhoneList[i + j:i + j + numBlanks]
                phoneList.extend(tmpPhoneList)
                j += numBlanks
        
        for k, phone in enumerate(phoneList):
            if phone == u"''":
                syllable.insert(k, u"''")
        
        i += j
        
        retSyllableList.append(syllable)
    
    return retSyllableList
897655
def find_alliteration(self):
        
        if len(self.phonological_features_text) == 0:
            logger.error("No phonological transcription found")
            raise ValueError
        else:
            first_sounds = []
            for i, line in enumerate(self.phonological_features_text):
                first_sounds.append([])
                for j, short_line in enumerate(line):
                    first_sounds[i].append([])
                    for viisuord in short_line:
                        first_sounds[i][j].append(viisuord[0])

            verse_alliterations = []
            n_alliterations_lines = []
            for i, first_sound_line in enumerate(first_sounds):
                if isinstance(self.long_lines[i][0], ShortLine) and isinstance(self.long_lines[i][1], ShortLine):
                    self.long_lines[i][0].get_first_sounds()
                    self.long_lines[i][1].get_first_sounds()
                    alli, counter = self.long_lines[i][0].find_alliterations(self.long_lines[i][1])
                    verse_alliterations.append(alli)
                    n_alliterations_lines.append(counter)
                elif isinstance(self.long_lines[i][0], LongLine):
                    self.long_lines[i][0].get_first_sounds()
                    alli, counter = self.long_lines[i][0].find_alliterations()
                    verse_alliterations.append(alli)
                    n_alliterations_lines.append(counter)
            return verse_alliterations, n_alliterations_lines
1279223
def is_ipa(s):
    """"""
    re_pattern = ('(?:%(syllable)s|[ \t%(punctuation)s])+' %
                  {'syllable': _IPA_SYLLABLE,
                   'punctuation': zhon.pinyin.punctuation})
    return _is_pattern_match(re_pattern, s)
1359057
def __get_idxs(self, words):
        """"""
        if self.bow:
            return list(itertools.chain.from_iterable(
                [self.positions[z] for z in words]))
        else:
            return self.positions[words]
370887
def findOODWords(isleDict, wordList):
    '''
    
    '''
    oodList = []
    for word in wordList:
        try:
            isleDict.lookup(word)
        except WordNotInISLE:
            oodList.append(word)
                
    oodList = list(set(oodList))
    oodList.sort()
    
    return oodList
614436
def apply_T5(word):  # BROKEN
    ''''''
    T5 = ''
    WORD = word.split('.')

    for i, v in enumerate(WORD):
        if contains_VVV(v) and any(i for i in i_DIPHTHONGS if i in v):
            I = v.rfind('i') - 1 or 2
            I = I + 2 if is_consonant(v[I - 1]) else I
            WORD[i] = v[:I] + '.' + v[I:]
            T5 = ' T5'

    word = '.'.join(WORD)

    return word, T5
922871
def stringify(syllables) :
	''''''
	ret = []
	for syl in syllables :
		stress, onset, nucleus, coda = syl
		if stress != None and len(nucleus) != 0 :
			nucleus[0] += str(stress)
		ret.append(" ".join(onset + nucleus + coda))
	return " . ".join(ret)
743864
def syllabify(self, word):
        """"""

        prefixes = self.language['single_syllable_prefixes']
        prefixes.sort(key=len, reverse=True)

        # Check if word is in exception dictionary
        if word in self.language['exceptions']:
            syllables = self.language['exceptions'][word]

        # Else, breakdown syllables for word
        else:
            syllables = []

            # Remove prefixes
            for prefix in prefixes:
                if word.startswith(prefix):
                    syllables.append(prefix)
                    word = re.sub('^%s' % prefix, '', word)
                    break

            # Initialize syllable to build by iterating through over characters
            syllable = ''

            # Get word length for determining character position in word
            word_len = len(word)

            # Iterate over characters to build syllables
            for i, char in enumerate(word):

                # Build syllable
                syllable = syllable + char
                syllable_complete = False

                # Checks to process syllable logic
                char_is_vowel = self._is_vowel(char)
                has_next_char = i < word_len - 1
                has_prev_char = i > 0

                # If it's the end of the word, the syllable is complete
                if not has_next_char:
                    syllable_complete = True

                else:
                    next_char = word[i + 1]
                    if has_prev_char:
                        prev_char = word[i - 1]

                    # 'i' is a special case for a vowel. when i is at the 
                    # beginning of the word (Iesu) or i is between 
                    # vowels (alleluia), then the i is treated as a 
                    # consonant (y) Note: what about compounds like 'adiungere'
                    if char == 'i' and has_next_char and self._is_vowel(next_char): 
                        if i == 0:
                            char_is_vowel = False
                        elif self._is_vowel(prev_char):
                            char_is_vowel = False

                    # Determine if the syllable is complete
                    if char_is_vowel:

                        if (
                                    (  # If the next character's a vowel
                                       self._is_vowel(
                                               next_char)  # And it doesn't compose a dipthong with the current character
                                       and not self._is_diphthong(char,
                                                                  next_char)  # And the current character isn't preceded by a q, unless followed by a u
                                       and not (
                                                           has_prev_char
                                                       and prev_char == "q"
                                                   and char == "u"
                                               and next_char != "u"
                                       )

                                       )
                                or (
                                        # If the next character's a consonant but not a double consonant, unless it's a mute consonant followed by a liquid consonant
                                        i < word_len - 2
                                        and (
                                                        (
                                                                    (
                                                                                        has_prev_char
                                                                                    and prev_char != "q"
                                                                                and char == "u"
                                                                            and self._is_vowel(word[i + 2])
                                                                    )
                                                                or (
                                                                                not has_prev_char
                                                                            and char == "u"
                                                                        and self._is_vowel(word[i + 2])
                                                                )
                                                        )
                                                    or (
                                                                        char != "u"
                                                                and self._is_vowel(word[i + 2])
                                                            and not self._is_diphthong(char, next_char)
                                                    )
                                                or (
                                                            self._is_mute_consonant_or_f(next_char)
                                                        and self._is_liquid_consonant(word[i + 2])
                                                )
                                        )

                                )
                        ):
                            syllable_complete = True

                    # Otherwise, it's a consonant
                    else:

                        if (  # If the next character's also a consonant (but it's not the last in the word)
                              (

                                          not self._is_vowel(next_char)
                                      and i < word_len - 2
                              )  # If the char's not a mute consonant followed by a liquid consonant
                              and not (
                                          self._is_mute_consonant_or_f(char)
                                      and self._is_liquid_consonant(next_char)
                              )  # If the char's not a c, p, or t followed by an h
                              and not (
                                          (
                                                              has_prev_char
                                                          and not self._is_vowel(prev_char)
                                                      and char in ['c', 'p', 't'] and next_char == 'h'
                                          )
                                      or (
                                                      not has_prev_char
                                                  and char in ['c', 'p', 't'] and next_char == 'h'
                                      )
                              )  # And it's not the only letter in the syllable
                              and not len(syllable) == 1

                              ):
                            syllable_complete = True

                # If it's a complete syllable, append it to syllables list and reset syllable
                if syllable_complete:
                    syllables.append(syllable)
                    syllable = ''

        return syllables
650969
def syllabify(self, unsyllabified_tokens):
        
        syllables = self.make_syllables(unsyllabified_tokens)
        qu_fixed_syllables = self._qu_fix(syllables)
        elision_fixed_syllables = self._elision_fixer(qu_fixed_syllables)
        return elision_fixed_syllables
817873
def T2(word, rules):
    ''''''
    WORD = word
    offset = 0

    for vv in vv_sequences(WORD):
        seq = vv.group(1)

        if not phon.is_diphthong(seq) and not phon.is_long(seq):
            i = vv.start(1) + 1 + offset
            WORD = WORD[:i] + '.' + WORD[i:]
            offset += 1

    rules += ' T2' if word != WORD else ''

    return WORD, rules
898965
def get_times_from_utterance(utterance: str,
                             char_offset_to_token_index: Dict[int, int],
                             indices_of_approximate_words: Set[int]) -> Dict[str, List[int]]:
    

    pm_linking_dict = _time_regex_match(r'\d+pm',
                                        utterance,
                                        char_offset_to_token_index,
                                        pm_map_match_to_query_value,
                                        indices_of_approximate_words)

    am_linking_dict = _time_regex_match(r'\d+am',
                                        utterance,
                                        char_offset_to_token_index,
                                        am_map_match_to_query_value,
                                        indices_of_approximate_words)

    oclock_linking_dict = _time_regex_match(r"\d+ o'clock",
                                            utterance,
                                            char_offset_to_token_index,
                                            lambda match: digit_to_query_time(match.rstrip(" o'clock")),
                                            indices_of_approximate_words)

    hours_linking_dict = _time_regex_match(r"\d+ hours",
                                           utterance,
                                           char_offset_to_token_index,
                                           lambda match: [int(match.rstrip(" hours"))],
                                           indices_of_approximate_words)


    times_linking_dict: Dict[str, List[int]] = defaultdict(list)
    linking_dicts = [pm_linking_dict, am_linking_dict, oclock_linking_dict, hours_linking_dict]

    for linking_dict in linking_dicts:
        for key, value in linking_dict.items():
            times_linking_dict[key].extend(value)

    return times_linking_dict
371938
private static int totalSyllables(String strText) {
        int intSyllableCount = 0;
        
        List<String> arrWords = (new WhitespaceTokenizer()).tokenize(strText);
        int intWordCount = arrWords.size();
        for (int i = 0; i < intWordCount; ++i) {
            intSyllableCount += syllableCount(arrWords.get(i));
        }
        return intSyllableCount;
    }
1326335
def orthographic_syllabify(self, word):
        """"""
        p_vectors = [self.get_phonetic_feature_vector(c, self.lang) for c in word]

        syllables = []

        for i in range(len(word)):
            v = p_vectors[i]

            syllables.append(word[i])

            if i + 1 < len(word) and (not self.is_valid(p_vectors[i + 1]) or self.is_misc(p_vectors[i + 1])):
                syllables.append(u' ')

            elif not self.is_valid(v) or self.is_misc(v):
                syllables.append(u' ')

            elif self.is_vowel(v):

                anu_nonplos = (i + 2 < len(word) and
                               self.is_anusvaar(p_vectors[i + 1]) and
                               not self.is_plosive(p_vectors[i + 2])
                               )

                anu_eow = (i + 2 == len(word) and
                           self.is_anusvaar(p_vectors[i + 1]))

                if not (anu_nonplos or anu_eow):
                    syllables.append(u' ')

            elif i + 1 < len(word) and (self.is_consonant(v) or self.is_nukta(v)):
                if self.is_consonant(p_vectors[i + 1]):
                    syllables.append(u' ')
                elif self.is_vowel(p_vectors[i + 1]) and not self.is_dependent_vowel(p_vectors[i + 1]):
                    syllables.append(u' ')
                elif self.is_anusvaar(p_vectors[i + 1]):
                    anu_nonplos = (i + 2 < len(word) and not self.is_plosive(p_vectors[i + 2]))

                    anu_eow = i + 2 == len(word)

                    if not (anu_nonplos or anu_eow):
                        syllables.append(u' ')

        return u''.join(syllables).strip().split(u' ')