coqui-tts/TTS/tts/utils/text
Martin Weinelt 994be163e1
Use packaging.version for version comparisons (#2310)
* Use packaging.version for version comparisons

The distutils package is deprecated¹ and relies on PEP 386² version
comparisons, which have been superseded by PEP 440³ which is implemented
through the packaging module.

With more recent distutils versions, provided through setuptools
vendoring, we are seeing the following exception during version
comparisons:

> TypeError: '<' not supported between instances of 'str' and 'int'

This is fixed by this migration.

[1] https://docs.python.org/3/library/distutils.html
[2] https://peps.python.org/pep-0386/
[3] https://peps.python.org/pep-0440/

* Improve espeak version detection robustness

On many modern systems espeak is just a symlink to espeak-ng. In that
case looking for the 3rd word in the version output will break the
version comparison, when it finds `text-to-speech:`, instead of a proper
version.

This will not break during runtime, where espeak-ng would be
prioritized, but the phonemizer and tokenizer tests force the backend
to `espeak`, which exhibits this breakage.

This improves the version detection by simply looking for the version
after the "text-to-speech:" token.

* Replace distuils.copy_tree with shutil.copytree

The distutils module is deprecated and slated for removal in Python
3.12. Its usage should be replaced, in this case by a compatible method
from shutil.
2023-01-29 23:47:00 +01:00
..
chinese_mandarin Create language folders under `TTS.tts.utils.text` 2022-02-25 09:32:54 +01:00
english Create `text/english` folder 2022-02-25 09:32:54 +01:00
french Create language folders under `TTS.tts.utils.text` 2022-02-25 09:32:54 +01:00
japanese Update Japanese phonemizer (#758) 2021-09-01 09:33:15 +02:00
korean Prevent installing mecab-ko (#1967) 2022-09-14 10:28:07 +02:00
phonemizers Use packaging.version for version comparisons (#2310) 2023-01-29 23:47:00 +01:00
__init__.py Remove OLD TOKENIZATION ROUTINES 2022-02-25 09:32:54 +01:00
characters.py Update Characters and add more tests 2022-02-25 11:32:44 +01:00
cleaners.py Add Catalan text cleaners for Catalan support (#2295) 2023-01-23 11:56:30 +01:00
cmudict.py reformatting and styling 2021-04-12 11:47:39 +02:00
punctuation.py Fix tokenizer for punc only (#1717) 2022-07-06 22:59:41 +02:00
tokenizer.py Multilingual tokenizer (#2229) 2023-01-02 10:03:19 +01:00