Commit b5fba479765092a16724ec8288add8c3f2e9e0ce

Authored by Erickson Silva
1 parent 927ebcc7
Exists in master and in 1 other branch devel

Adiciona traceback no logging

src/AplicaRegras.py
... ... @@ -13,7 +13,6 @@ from os.path import expanduser
13 13 from collections import deque
14 14 from LerDicionarios import *
15 15 from Iterator import *
16   -from StringAux import *
17 16 from ConverteExtenso import *
18 17 from nltk_tgrep import tgrep_positions, tgrep_nodes
19 18 from nltk import ParentedTree, Tree, draw
... ...
src/PortGlosa.py
... ... @@ -9,10 +9,14 @@
9 9 from TraduzSentencas import *
10 10  
11 11 def traduzir(texto):
  12 + if texto.isspace() or texto == "":
  13 + return "SELECIONE UM TEXTO"
  14 +
12 15 glosa = iniciar_traducao(texto)
  16 +
13 17 if glosa:
14 18 return glosa
15   - return "selecione_texto"
  19 + return "HOUVE UM ERRO. TENTE NOVAMENTE"
16 20  
17 21 def iniciar_traducao(texto):
18 22 texto_quebrado = quebrar_texto(texto)
... ...
src/TraduzSentencas.py
... ... @@ -11,6 +11,7 @@ import alexp
11 11 from AplicaSinonimos import *
12 12 from AplicaRegras import *
13 13 import logging
  14 +import traceback
14 15  
15 16 class TraduzSentencas(Thread):
16 17  
... ... @@ -21,7 +22,7 @@ class TraduzSentencas(Thread):
21 22 self.aplic_sinonimos = AplicaSinonimos()
22 23 self.aplic_regras = AplicaRegras()
23 24 logging.basicConfig(filename='translate.log',
24   - format='%(asctime)s - %(levelname)s:\n%(message)s\n\n\n##############################################\n\n',
  25 + format='%(asctime)s - %(levelname)s:\n\n%(message)s\n\n\n##############################################\n\n',
25 26 level=logging.ERROR)
26 27  
27 28  
... ... @@ -29,7 +30,7 @@ class TraduzSentencas(Thread):
29 30 try:
30 31 analise_sintatica = alexp.run(self.sentenca)
31 32 except Exception as ex:
32   - self.salvar_log(str(ex))
  33 + self.salvar_log(str(traceback.format_exc()))
33 34 analise_sintatica = None
34 35  
35 36 analise_morfologica = alexp.getAnaliseMorfologica()
... ...