From 35536d5e4042c686fd9de2d36ef858e1257fb1f4 Mon Sep 17 00:00:00 2001 From: fabianosan Date: Mon, 6 Jan 2025 15:21:48 -0300 Subject: [PATCH] =?UTF-8?q?Corre=C3=A7=C3=A3o=20de=20uso=20de=20acentua?= =?UTF-8?q?=C3=A7=C3=B5es=20em=20alguns=20idiomas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lambda_functions/lambda_function.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lambda_functions/lambda_function.py b/lambda_functions/lambda_function.py index 8c76b9d..0fa7115 100644 --- a/lambda_functions/lambda_function.py +++ b/lambda_functions/lambda_function.py @@ -251,10 +251,11 @@ def replace_words(query): def improve_response(speech): # Função para melhorar a legibilidade da resposta speech = speech.replace(':\n\n', '').replace('\n\n', '. ').replace('\n', ',').replace('-', '').replace('_', ' ') + #replacements = str.maketrans('ïöüÏÖÜ', 'iouIOU') #speech = speech.translate(replacements) - #speech = re.sub(r'[^A-Za-z0-9çÇáàâãéèêíóôõúñÁÀÂÃÉÈÊÍÓÔÕÚÑ\s.,!?]', '', speech) - speech = re.sub(r'[^A-Za-z0-9\s.,!?]', '', speech) + + speech = re.sub(r'[^A-Za-z0-9çÇáàâãéèêíïóôõöúüñÁÀÂÃÉÈÊÍÏÓÔÕÖÚÜÑ\s.,!?]', '', speech) return speech # Carrega o template do APL da tela inicial