Skip to content
This repository has been archived by the owner on Jun 22, 2021. It is now read-only.

Commit

Permalink
Fix LF localization error, bump text2speech ver.
Browse files Browse the repository at this point in the history
  • Loading branch information
ChanceNCounter committed Jun 8, 2021
1 parent 809cdc0 commit 0078f3c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ psutil
gTTS>=2.2.2
voxpopuli
# pyee pinned because of mycroft
pyee==8.1.0
pyee==8.1.0
lingua_franca>=0.4.2
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

setup(
name='text2speech',
version='0.2.0a1',
version='0.2.1a1',
packages=['text2speech', 'text2speech.modules'],
url='https://github.com/HelloChatterbox/text2speech',
license='apache',
Expand All @@ -59,6 +59,7 @@
"psutil",
"gTTS>=2.2.1",
"pyee==8.1.0",
"lingua_franca>=0.4.2"
"voxpopuli"],
author_email='[email protected]',
description='TTS engines',
Expand Down
13 changes: 9 additions & 4 deletions text2speech/modules/mimic2_tts.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
from requests.exceptions import (
ReadTimeout, ConnectionError, ConnectTimeout, HTTPError
)

from lingua_franca.format import pronounce_number
import lingua_franca.config

from urllib import parse
import math
import base64
Expand All @@ -16,6 +20,8 @@

max_sentence_size = 170

lingua_franca.config.load_langs_on_demand = True


def break_chunks(l, n):
"""Yield successive n-sized chunks from l."""
Expand Down Expand Up @@ -243,18 +249,18 @@ def _normalized_numbers(self, sentence):
stf: normalized sentences to speak
"""
try:
from lingua_franca.format import pronounce_number
numbers = re.findall(r'-?\d+', sentence)
normalized_num = [
(num, pronounce_number(int(num)))
(num, pronounce_number(int(num), lang=self.lang))
for num in numbers
]
for num, norm_num in normalized_num:
sentence = sentence.replace(num, norm_num, 1)
except TypeError:
LOG.exception("type error in mimic2_tts.py _normalized_numbers()")
except ImportError:
LOG.warning("lingua_franca not installed, can not normalize numbers")
LOG.warning(
"lingua_franca not installed, can not normalize numbers")
return sentence

def get_tts(self, sentence, wav_file):
Expand Down Expand Up @@ -339,4 +345,3 @@ def validate_connection(self):

def get_tts_class(self):
return Mimic2

0 comments on commit 0078f3c

Please sign in to comment.