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 | 228 | node_pai[nodes_positions[count_temp]][0][0].set_label(newprop.text) |
229 | 229 | |
230 | 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 | 236 | if newprop is not None: |
239 | 237 | node_pai[nodes_positions[self.count]].set_label(newprop.text) |
240 | 238 | |
241 | 239 | break |
242 | - | |
243 | 240 | return self.converter_arv_para_lista(p_arvore) |
244 | 241 | |
245 | 242 | def adaptar_regras_morfo_arvore(self, lista, arvore): |
... | ... | @@ -262,7 +259,10 @@ class AplicaRegras(object): |
262 | 259 | |
263 | 260 | # Corrige arvore de acordo com a lista após aplicar as regras morfológicas |
264 | 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 | 266 | new_node = self.gerar_no(morfo[i]) |
267 | 267 | arvore[lista_pos_arv[i-1][:-3]].insert(2, new_node) |
268 | 268 | #arvore[lista_pos_arv[i-1][:-2]].insert(2, new_node) | ... | ... |
src/TraduzSentencas.py
... | ... | @@ -19,7 +19,7 @@ class TraduzSentencas(object): |
19 | 19 | '''Instancia os aplicadores de regras e sinônimos. |
20 | 20 | ''' |
21 | 21 | self.aplic_regras = AplicaRegras() |
22 | - #logging.basicConfig(filename='translate.log', | |
22 | + #logging.basicConfig(filename='/tmp/vlibras-translate.log', | |
23 | 23 | # format='%(asctime)s - %(levelname)s:\n\n%(message)s\n\n\n##############################################\n\n', |
24 | 24 | # level=logging.ERROR) |
25 | 25 | |
... | ... | @@ -35,7 +35,7 @@ class TraduzSentencas(object): |
35 | 35 | has_sintatica = False |
36 | 36 | |
37 | 37 | analise_morfologica = alexp.getAnaliseMorfologica() |
38 | - | |
38 | + | |
39 | 39 | if (isinstance(analise_sintatica,type(None))): |
40 | 40 | regras_aplicadas = self.aplic_regras.aplicar_regras_morfo(analise_morfologica) |
41 | 41 | else: | ... | ... |