Skip to content

Commit

Permalink
Correção de uso de acentuações em alguns idiomas
Browse files Browse the repository at this point in the history
  • Loading branch information
fabianosan committed Jan 6, 2025
1 parent c07636a commit 35536d5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lambda_functions/lambda_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 35536d5

Please sign in to comment.