How to use the cltk.prosody.latin.string_utils.remove_blank_spaces function in cltk

To help you get started, we’ve selected a few cltk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cltk / cltk / cltk / prosody / latin / syllabifier.py View on Github external
def _setup(self, word) -> List[str]:
        """
        Prepares a word for syllable processing.

        If the word starts with a prefix, process it separately.
        :param word:
        :return:
        """
        if len(word) == 1:
            return [word]
        for prefix in self.constants.PREFIXES:
            if word.startswith(prefix):
                (first, rest) = string_utils.split_on(word, prefix)
                if self._contains_vowels(rest):
                    return string_utils.remove_blank_spaces(
                        self._process(first) + self._process(rest))
                # a word like pror can happen from ellision
                return string_utils.remove_blank_spaces(self._process(word))
        if word in self.constants.UI_EXCEPTIONS.keys():
            return self.constants.UI_EXCEPTIONS[word]
        return string_utils.remove_blank_spaces(self._process(word))
github cltk / cltk / cltk / prosody / latin / syllabifier.py View on Github external
:param word:
        :return:
        """
        if len(word) == 1:
            return [word]
        for prefix in self.constants.PREFIXES:
            if word.startswith(prefix):
                (first, rest) = string_utils.split_on(word, prefix)
                if self._contains_vowels(rest):
                    return string_utils.remove_blank_spaces(
                        self._process(first) + self._process(rest))
                # a word like pror can happen from ellision
                return string_utils.remove_blank_spaces(self._process(word))
        if word in self.constants.UI_EXCEPTIONS.keys():
            return self.constants.UI_EXCEPTIONS[word]
        return string_utils.remove_blank_spaces(self._process(word))
github cltk / cltk / cltk / prosody / latin / syllabifier.py View on Github external
Prepares a word for syllable processing.

        If the word starts with a prefix, process it separately.
        :param word:
        :return:
        """
        if len(word) == 1:
            return [word]
        for prefix in self.constants.PREFIXES:
            if word.startswith(prefix):
                (first, rest) = string_utils.split_on(word, prefix)
                if self._contains_vowels(rest):
                    return string_utils.remove_blank_spaces(
                        self._process(first) + self._process(rest))
                # a word like pror can happen from ellision
                return string_utils.remove_blank_spaces(self._process(word))
        if word in self.constants.UI_EXCEPTIONS.keys():
            return self.constants.UI_EXCEPTIONS[word]
        return string_utils.remove_blank_spaces(self._process(word))
github cltk / cltk / cltk / prosody / latin / syllabifier.py View on Github external
Counts the number of syllable groups that would occur after ellision.

        Often we will want preserve the position and separation of syllables so that they
        can be used to reconstitute a line, and apply stresses to the original word positions.
        However, we also want to be able to count the number of syllables accurately.

        :param syllables:
        :return:

        >>> syllabifier = Syllabifier()
        >>> print(syllabifier.get_syllable_count([
        ... 'Jām', 'tūm', 'c', 'au', 'sus', 'es', 'u', 'nus', 'I', 'ta', 'lo', 'rum']))
        11
        """
        tmp_syllables = copy.deepcopy(syllables)
        return len(string_utils.remove_blank_spaces(
            string_utils.move_consonant_right(tmp_syllables,
                                             self._find_solo_consonant(tmp_syllables))))
github cltk / cltk / cltk / prosody / latin / syllabifier.py View on Github external
syllables += self._setup(item)
        for idx, syl in enumerate(syllables):
            if "kw" in syl:
                syl = syl.replace("kw", "qu")
                syllables[idx] = syl
            if "Kw" in syl:
                syl = syl.replace("Kw", "Qu")
                syllables[idx] = syl
            if "gw" in syl:
                syl = syl.replace("gw", "gu")
                syllables[idx] = syl
            if "Gw" in syl:
                syl = syl.replace("Gw", "Gu")
                syllables[idx] = syl

        return string_utils.remove_blank_spaces(syllables)