From d90270314761ab85b9a083a7dbdfb717f83272d0 Mon Sep 17 00:00:00 2001 From: Erickson Silva Date: Mon, 27 Apr 2015 10:30:54 -0300 Subject: [PATCH] Adiciona main ao PortGlosa e retira acentuacao da glosa --- data/regras.xml | 40 ++++++++++++++++++++++++---------------- src/PortGlosa.py | 22 +++++++--------------- src/TraduzSentencas.py | 5 +++-- 3 files changed, 34 insertions(+), 33 deletions(-) diff --git a/data/regras.xml b/data/regras.xml index e779963..a5ac1bc 100644 --- a/data/regras.xml +++ b/data/regras.xml @@ -896,10 +896,11 @@ - false + true 2 - VB + VB + remove ADV-R @@ -948,7 +949,7 @@ - false + true 2 ADV-R @@ -962,10 +963,11 @@ - false + true 2 ADJ + remove ADV-R @@ -1000,7 +1002,7 @@ - false + true 2 ADV-R @@ -1014,10 +1016,11 @@ - false + true 2 ADJ-F + remove ADV-R @@ -1052,7 +1055,7 @@ - false + true 2 ADV-R @@ -1066,10 +1069,11 @@ - false + true 2 ADJ-G + remove ADV-R @@ -1104,7 +1108,7 @@ - false + true 2 ADV-R @@ -1118,10 +1122,11 @@ - false + true 2 ADJ-P + remove ADV-R @@ -1156,7 +1161,7 @@ - false + true 2 ADV-R @@ -1170,10 +1175,11 @@ - false + true 2 ADJ-F-P + remove ADV-R @@ -1208,7 +1214,7 @@ - false + true 2 ADV-R @@ -1222,10 +1228,11 @@ - false + true 2 ADJ-G-P + remove ADV-R @@ -1416,7 +1423,7 @@ - false + true 2 ADV-R @@ -1430,10 +1437,11 @@ - false + true 2 ADV + remove ADV-R diff --git a/src/PortGlosa.py b/src/PortGlosa.py index ac8652f..bdc82a3 100644 --- a/src/PortGlosa.py +++ b/src/PortGlosa.py @@ -6,6 +6,7 @@ #LAViD - Laboratório de Aplicações de Vídeo Digital +import sys from ThreadTradutor import * from TraduzSentencas import * from LerDicionarios import * @@ -51,20 +52,6 @@ def iniciar_sem_threads(texto): texto_traduzido.append(glosa) return " ".join(texto_traduzido) -''' -def quebrar_texto(texto): - quantidade_pontos = texto.count('. ') - sentencas = [] - if quantidade_pontos == 0: - return [texto] - for i in range(quantidade_pontos): - posicao_ponto = texto.find('.') - if texto[posicao_ponto+2].isupper(): - sentencas.append(texto[:posicao_ponto]) - texto = texto[posicao_ponto+2:] - return sentencas -''' - def quebrar_texto(texto): if '.' not in texto: return [texto] @@ -87,4 +74,9 @@ def quebrar_texto(texto): def ajuda(): #TODO: Adicionar um pequeno tuto aqui - print "Help" \ No newline at end of file + print "Help" + +if __name__ == '__main__': + texto = sys.argv[1] + glosa = traduzir(texto) + sys.exit(glosa) \ No newline at end of file diff --git a/src/TraduzSentencas.py b/src/TraduzSentencas.py index d12ddfc..74d61b3 100644 --- a/src/TraduzSentencas.py +++ b/src/TraduzSentencas.py @@ -45,9 +45,10 @@ class TraduzSentencas(object): regras_aplicadas = self.aplic_regras.aplicar_regras_morfo(analise_morfologica) sentenca_corrigida = self.aplic_regras.simplificar_sentenca(regras_aplicadas) + sentenca_sem_acentos = self.aplic_regras.remover_acento(sentenca_corrigida) - if sentenca_corrigida: - return sentenca_corrigida.upper().encode('utf-8') + if sentenca_sem_acentos: + return sentenca_sem_acentos.upper().encode('utf-8') return "TEXTO ERRADO ESCOLHER OUTRO" def salvar_log(self, erro): -- libgit2 0.21.2