Syllabify the given word, whether simplex or complex.
514776
def syllabify(word):
    ''''''
    compound = bool(re.search(r'(-| |=)', word))
    syllabify = _syllabify_compound if compound else _syllabify
    syllabifications = list(syllabify(word))

    for syll, rules in syllabifications:
        yield syll, rules

    n = 16 - len(syllabifications)

    # yield empty syllabifications and rules
    for i in range(n):
        yield '', ''
120862
def merge_keywords(x,y):
    """"""
    z = x.copy()
    z.update(y)
    return z
830900
def apply_T2(word):
    ''''''
    WORD = _split_consonants_and_vowels(word)

    for k, v in WORD.iteritems():

        if is_diphthong(v):
            continue

        if len(v) == 2 and is_vowel(v[0]):

            if v[0] != v[1]:
                WORD[k] = v[0] + '.' + v[1]

    word = _compile_dict_into_word(WORD)

    return word
353488
def fromTerm(cls, term):
        """"""

        if isinstance(term, Term):
            term = term.handle
        elif not isinstance(term, (c_void_p, int)):
            raise ArgumentTypeError((str(Term), str(c_void_p)), str(type(term)))

        a = atom_t()
        if PL_get_atom(term, byref(a)):
            return cls(a.value)
397328
def ix(self, word):
        
        temp = np.where(self.vocab == word)[0]
        if temp.size == 0:
            raise KeyError("Word not in vocabulary")
        else:
            return temp[0]
319105
def iexpand(string, keep_escapes=False):
    """"""

    if isinstance(string, bytes):
        is_bytes = True
        string = string.decode('latin-1')

    else:
        is_bytes = False

    if is_bytes:
        return (entry.encode('latin-1') for entry in ExpandBrace(keep_escapes).expand(string))

    else:
        return (entry for entry in ExpandBrace(keep_escapes).expand(string))
328634
def apply_T4(word):  # OPTIMIZE
    ''''''
    WORD = _split_consonants_and_vowels(word)

    for k, v in WORD.iteritems():

        if len(v) == 2 and v.endswith(('u', 'y')):

            if WORD.get(k + 2, 0):

                if not WORD.get(k + 3, 0):
                    if len(WORD[k + 2]) == 1 and is_consonant(WORD[k + 2]):
                        WORD[k] = v[0] + '.' + v[1]

                elif len(WORD[k + 1]) == 1 and WORD.get(k + 3, 0):
                    if is_consonant(WORD[k + 3][0]):
                        WORD[k] = v[0] + '.' + v[1]

                elif len(WORD[k + 2]) == 2:
                    WORD[k] = v[0] + '.' + v[1]

    word = _compile_dict_into_word(WORD)

    return word
1293121
def _doublec(self, word):
        """"""
        if len(word) < 2:
            return False
        if (word[-1] != word[-2]):
            return False
        return self._cons(word, len(word)-1)
746563
def apply_T1(word):
    ''''''
    WORD = _split_consonants_and_vowels(word)

    for k, v in WORD.iteritems():

        if k == 1 and is_consonantal_onset(v):
            WORD[k] = '.' + v

        elif is_consonant(v[0]) and WORD.get(k + 1, 0):
            WORD[k] = v[:-1] + '.' + v[-1]

    word = _compile_dict_into_word(WORD)

    return word
86887
def annotate(self, word):
        ''''''
        info = []  # e.g., [ ('\'nak.su.`tus.ta', 'PUSU', 'HLHL', 'AUUA'), ]

        for syllabification, _ in syllabify(self.normalize(word), stress=True):
            stresses = ''
            weights = ''
            vowels = ''

            for syll in syllable_split(syllabification):

                try:
                    vowels += get_vowel(syll)
                    weights += get_weight(syll)
                    stresses += {'\'': 'P', '`': 'S'}.get(syll[0], 'U')

                except AttributeError:

                    # if the syllable is vowel-less...
                    if syll[-1].isalpha():
                        stresses += '*'
                        weights += '*'
                        vowels += '*'

                    else:
                        stresses += ' '
                        weights += ' '
                        vowels += ' '

            info.append((
                syllabification,
                stresses,
                weights,
                vowels,
                ))

        return info
617802
protected int simpleSyllablesCount(String word) {
    if(word.length() == 0) {
      return 0;
    }
    if(word.length() == 1) {
      return 1;
    }
    int nSyllables = 0;
    boolean lastDouble = false;
    for (int i = 0; i < word.length() - 1; i++) {
      char c = word.charAt(i);
      if(isVowel(c)) {
        char cn = word.charAt(i + 1);
        if(lastDouble) {
          nSyllables++;
          lastDouble = false;
        } else if(((c == 'e' || c == 'E') && (cn == 'a' || cn == 'o' || cn == 'e' || cn == 'i' || cn == 'y')) || 
            ((c == 'a' || c == 'A') && (cn == 'e' || cn == 'i' || cn == 'u')) ||
            ((c == 'o' || c == 'O') && (cn == 'o' || cn == 'i' || cn == 'u' || cn == 'a')) ||
            ((c == 'u' || c == 'U') && (cn == 'i' || cn == 'a')) ||
            ((c == 'i' || c == 'I') && (cn == 'e'|| cn == 'o'))) {
          lastDouble = true;
        } else {
          nSyllables++;
          lastDouble = false;
        }
      } else {
        lastDouble = false;
      }
    }
    char c = word.charAt(word.length() - 1);
    char cl = word.charAt(word.length() - 2);
    if (cl == 'e' && (c == 's' || c == 'd') || cl == 'u' && c == 'e') {
        nSyllables--;
    } else if (isVowel(c) && c != 'e') {
        nSyllables++;
    }
    return nSyllables <= 0 ? 1 : nSyllables;
  }
657283
def fromTerm(cls, term):
        """"""

        if isinstance(term, Term):
            term = term.handle
        elif not isinstance(term, (c_void_p, int)):
            raise ArgumentTypeError((str(Term), str(int)), str(type(term)))

        f = functor_t()
        if PL_get_functor(term, byref(f)):
            # get args
            args = []
            arity = PL_functor_arity(f.value)
            # let's have all args be consecutive
            a0 = PL_new_term_refs(arity)
            for i, a in enumerate(range(1, arity + 1)):
                if PL_get_arg(a, term, a0 + i):
                    args.append(getTerm(a0 + i))

            return cls(f.value, args=args, a0=a0)
556709
def morpheme(self,index, set=None):
        """"""
        for layer in self.select(MorphologyLayer):
            for i, m in enumerate(layer.select(Morpheme, set)):
                if index == i:
                    return m
        raise NoSuchAnnotation
558593
def syllabify(word):
    ''''''
    compound = bool(re.search(r'(-| |=)', word))
    syllabify = _syllabify_compound if compound else _syllabify_simplex
    syllabifications = list(syllabify(word))

    for word, rules in rank(syllabifications):
        # post-process
        word = str(replace_umlauts(word, put_back=True))
        rules = rules[1:]

        yield word, rules
445738
private void addWord(String word, boolean containsNewLine) {
        currentSentence.add(word);
        if (containsNewLine) {
            sentences.add(getSentenceFromListCheckingNewLines(currentSentence));
            currentSentence.clear();
        }
    }
183888
def iflatten(seq, isSeq=isSeq):
    """
    for elt in seq:
        if isSeq(elt):
            for x in iflatten(elt, isSeq):
                yield x
        else:
            yield elt
186885
def apply_T2(word):
    ''''''
    T2 = ''
    WORD = word.split('.')

    for i, v in enumerate(WORD):

        if not contains_diphthong(v):
            VV = contains_VV(v)

            if VV:
                I = v.find(VV) + 1
                WORD[i] = v[:I] + '.' + v[I:]
                T2 = ' T2'

    word = '.'.join(WORD)

    return word, T2