From 824e58887ea10a7a154e5e45e2370b8993be32d4 Mon Sep 17 00:00:00 2001 From: lkrsnik Date: Fri, 17 Aug 2018 11:53:25 +0200 Subject: [PATCH] Added managing of ''' and ':' --- text2SAMPA.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/text2SAMPA.py b/text2SAMPA.py index d987b38..1a3000a 100644 --- a/text2SAMPA.py +++ b/text2SAMPA.py @@ -86,6 +86,7 @@ def create_syllables(word, vowels): def convert_to_SAMPA(word): + word = word.lower() syllables = create_syllables(word, vowels) letters_in_stressed_syllable = [False] * len(word) # print(syllables) @@ -152,6 +153,11 @@ def convert_to_SAMPA(word): word = list(''.join(word)) + test_word = ''.join(word) + test_word = test_word.replace('"', '').replace(':', '') + if len(test_word) <= 1: + return ''.join(word) + previous_letter_i = -1 letter_i = 0 next_letter_i = 1