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

fixes LF localizer failure #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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_nostra>=0.4.3
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_nostra>=0.4.3"
"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_nostra.format import pronounce_number
import lingua_nostra.config

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

max_sentence_size = 170

lingua_nostra.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_nostra 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