Commit ba9507efc1941b6d5959f8a37ebfbf80c90071b3
1 parent
c15c4446
Exists in
master
and in
1 other branch
Conserta erro na aplicação das regras morfológicas na árvore
Showing
2 changed files
with
10 additions
and
10 deletions
Show diff stats
src/AplicaRegras.py
@@ -228,18 +228,15 @@ class AplicaRegras(object): | @@ -228,18 +228,15 @@ class AplicaRegras(object): | ||
228 | node_pai[nodes_positions[count_temp]][0][0].set_label(newprop.text) | 228 | node_pai[nodes_positions[count_temp]][0][0].set_label(newprop.text) |
229 | 229 | ||
230 | elif action_text == "concate_neg": | 230 | elif action_text == "concate_neg": |
231 | - print 'TODO' | ||
232 | - #if nodes_deleted: | ||
233 | - | ||
234 | - | ||
235 | - #else: | ||
236 | - | 231 | + token = filter(None, node_pai[nodes_positions[count_temp]].leaves())[0] |
232 | + token_concate = token + "_não" | ||
233 | + node_pai[nodes_positions[count_temp]][0][0][0] = token_concate | ||
234 | + # TODO: PRECISA ADD NEWPROP? | ||
237 | 235 | ||
238 | if newprop is not None: | 236 | if newprop is not None: |
239 | node_pai[nodes_positions[self.count]].set_label(newprop.text) | 237 | node_pai[nodes_positions[self.count]].set_label(newprop.text) |
240 | 238 | ||
241 | break | 239 | break |
242 | - | ||
243 | return self.converter_arv_para_lista(p_arvore) | 240 | return self.converter_arv_para_lista(p_arvore) |
244 | 241 | ||
245 | def adaptar_regras_morfo_arvore(self, lista, arvore): | 242 | def adaptar_regras_morfo_arvore(self, lista, arvore): |
@@ -262,7 +259,10 @@ class AplicaRegras(object): | @@ -262,7 +259,10 @@ class AplicaRegras(object): | ||
262 | 259 | ||
263 | # Corrige arvore de acordo com a lista após aplicar as regras morfológicas | 260 | # Corrige arvore de acordo com a lista após aplicar as regras morfológicas |
264 | for i in range(0, len(morfo)): | 261 | for i in range(0, len(morfo)): |
265 | - if morfo[i] is not None and morfo[i][1] == "NTK": | 262 | + #TODO: Corrigir essa verificação de FUTURO e PASSADO] |
263 | + #TODO: Exclusão do nó inteiro (VBar) - Removendo palavra junto com a marcação de tempo | ||
264 | + # EU FELIZ PASSADO -> EU FELIZ | ||
265 | + if morfo[i] is not None and morfo[i][1] == "NTK" and morfo[i][0]: | ||
266 | new_node = self.gerar_no(morfo[i]) | 266 | new_node = self.gerar_no(morfo[i]) |
267 | arvore[lista_pos_arv[i-1][:-3]].insert(2, new_node) | 267 | arvore[lista_pos_arv[i-1][:-3]].insert(2, new_node) |
268 | #arvore[lista_pos_arv[i-1][:-2]].insert(2, new_node) | 268 | #arvore[lista_pos_arv[i-1][:-2]].insert(2, new_node) |
src/TraduzSentencas.py
@@ -19,7 +19,7 @@ class TraduzSentencas(object): | @@ -19,7 +19,7 @@ class TraduzSentencas(object): | ||
19 | '''Instancia os aplicadores de regras e sinônimos. | 19 | '''Instancia os aplicadores de regras e sinônimos. |
20 | ''' | 20 | ''' |
21 | self.aplic_regras = AplicaRegras() | 21 | self.aplic_regras = AplicaRegras() |
22 | - #logging.basicConfig(filename='translate.log', | 22 | + #logging.basicConfig(filename='/tmp/vlibras-translate.log', |
23 | # format='%(asctime)s - %(levelname)s:\n\n%(message)s\n\n\n##############################################\n\n', | 23 | # format='%(asctime)s - %(levelname)s:\n\n%(message)s\n\n\n##############################################\n\n', |
24 | # level=logging.ERROR) | 24 | # level=logging.ERROR) |
25 | 25 | ||
@@ -35,7 +35,7 @@ class TraduzSentencas(object): | @@ -35,7 +35,7 @@ class TraduzSentencas(object): | ||
35 | has_sintatica = False | 35 | has_sintatica = False |
36 | 36 | ||
37 | analise_morfologica = alexp.getAnaliseMorfologica() | 37 | analise_morfologica = alexp.getAnaliseMorfologica() |
38 | - | 38 | + |
39 | if (isinstance(analise_sintatica,type(None))): | 39 | if (isinstance(analise_sintatica,type(None))): |
40 | regras_aplicadas = self.aplic_regras.aplicar_regras_morfo(analise_morfologica) | 40 | regras_aplicadas = self.aplic_regras.aplicar_regras_morfo(analise_morfologica) |
41 | else: | 41 | else: |