How to use the gtts.tts.pre_processors function in gTTS

To help you get started, we’ve selected a few gTTS 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 Aculeasis / mdmTerminal2 / src / lib / stream_gTTS.py View on Github external
lang_check=True,
            pre_processor_funcs=None,
            tokenizer_func=gtts.tts.Tokenizer([
                gtts.tts.tokenizer_cases.tone_marks,
                gtts.tts.tokenizer_cases.period_comma,
                gtts.tts.tokenizer_cases.other_punctuation
            ]).run,
            **_
    ):

        if pre_processor_funcs is None:
            pre_processor_funcs = [
                gtts.tts.pre_processors.tone_marks,
                gtts.tts.pre_processors.end_of_line,
                gtts.tts.pre_processors.abbreviations,
                gtts.tts.pre_processors.word_sub
            ]
        # Text
        assert text, 'No text to speak'
        self.text = text

        # Language
        if lang_check:
            try:
                langs = gtts.tts.tts_langs()
                if lang.lower() not in langs:
                    raise ValueError("Language not supported: %s" % lang)
            except RuntimeError:
                pass

        self.lang_check = lang_check
        self.lang = lang.lower()
github Aculeasis / mdmTerminal2 / src / lib / stream_gTTS.py View on Github external
slow=False,
            lang_check=True,
            pre_processor_funcs=None,
            tokenizer_func=gtts.tts.Tokenizer([
                gtts.tts.tokenizer_cases.tone_marks,
                gtts.tts.tokenizer_cases.period_comma,
                gtts.tts.tokenizer_cases.other_punctuation
            ]).run,
            **_
    ):

        if pre_processor_funcs is None:
            pre_processor_funcs = [
                gtts.tts.pre_processors.tone_marks,
                gtts.tts.pre_processors.end_of_line,
                gtts.tts.pre_processors.abbreviations,
                gtts.tts.pre_processors.word_sub
            ]
        # Text
        assert text, 'No text to speak'
        self.text = text

        # Language
        if lang_check:
            try:
                langs = gtts.tts.tts_langs()
                if lang.lower() not in langs:
                    raise ValueError("Language not supported: %s" % lang)
            except RuntimeError:
                pass

        self.lang_check = lang_check
github Aculeasis / mdmTerminal2 / src / lib / stream_gTTS.py View on Github external
text,
            lang='en',
            slow=False,
            lang_check=True,
            pre_processor_funcs=None,
            tokenizer_func=gtts.tts.Tokenizer([
                gtts.tts.tokenizer_cases.tone_marks,
                gtts.tts.tokenizer_cases.period_comma,
                gtts.tts.tokenizer_cases.other_punctuation
            ]).run,
            **_
    ):

        if pre_processor_funcs is None:
            pre_processor_funcs = [
                gtts.tts.pre_processors.tone_marks,
                gtts.tts.pre_processors.end_of_line,
                gtts.tts.pre_processors.abbreviations,
                gtts.tts.pre_processors.word_sub
            ]
        # Text
        assert text, 'No text to speak'
        self.text = text

        # Language
        if lang_check:
            try:
                langs = gtts.tts.tts_langs()
                if lang.lower() not in langs:
                    raise ValueError("Language not supported: %s" % lang)
            except RuntimeError:
                pass
github Aculeasis / mdmTerminal2 / src / lib / stream_gTTS.py View on Github external
lang='en',
            slow=False,
            lang_check=True,
            pre_processor_funcs=None,
            tokenizer_func=gtts.tts.Tokenizer([
                gtts.tts.tokenizer_cases.tone_marks,
                gtts.tts.tokenizer_cases.period_comma,
                gtts.tts.tokenizer_cases.other_punctuation
            ]).run,
            **_
    ):

        if pre_processor_funcs is None:
            pre_processor_funcs = [
                gtts.tts.pre_processors.tone_marks,
                gtts.tts.pre_processors.end_of_line,
                gtts.tts.pre_processors.abbreviations,
                gtts.tts.pre_processors.word_sub
            ]
        # Text
        assert text, 'No text to speak'
        self.text = text

        # Language
        if lang_check:
            try:
                langs = gtts.tts.tts_langs()
                if lang.lower() not in langs:
                    raise ValueError("Language not supported: %s" % lang)
            except RuntimeError:
                pass