From a87ad34e9d500fdd5a2c975be919840e1cbd40b5 Mon Sep 17 00:00:00 2001 From: Divyansh Date: Thu, 19 Aug 2021 16:52:14 +0530 Subject: [PATCH] Add walk around for very big numbers (>36 digits) For numbers with more than 36 digits G2P will be throwing error due to some external module. The walk around will break the digits and will call G2P on each digits only. --- g2p_en/g2p.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/g2p_en/g2p.py b/g2p_en/g2p.py index 8b37659..69b8c4e 100644 --- a/g2p_en/g2p.py +++ b/g2p_en/g2p.py @@ -146,6 +146,15 @@ def predict(self, word): return preds def __call__(self, text): + + if text.isnumeric() and len(text) > 36: + #for very bigs number + #just read the digits + prons = [] + for i in range(len(text)): + prons += (self.__call__(text[i])) + return prons + # preprocessing text = unicode(text) text = normalize_numbers(text)