diff --git a/data/excecoesPlural.csv b/data/excecoesPlural.csv new file mode 100644 index 0000000..f9ab868 --- /dev/null +++ b/data/excecoesPlural.csv @@ -0,0 +1,2 @@ +vlibras +libras \ No newline at end of file diff --git a/src/new/LerDicionarios.py b/src/new/LerDicionarios.py index be522a3..7be223c 100644 --- a/src/new/LerDicionarios.py +++ b/src/new/LerDicionarios.py @@ -15,6 +15,7 @@ class LerDicionarios(object): def __init__(self): self.path = self.get_path() + self.set_exc_plural = [] self.dic_adv_intensidade = {} self.set_adv_tempo = [] self.set_art = [] @@ -33,6 +34,7 @@ class LerDicionarios(object): return expanduser("~") + "/vlibras-translate/data/" def carregar_dicionarios(self): + self.carregar_excecoes_plural() self.carregar_adverbios_intensidade() self.carregar_adverbios_tempo() self.carregar_artigos() @@ -43,6 +45,19 @@ class LerDicionarios(object): self.carregar_verbos_ligacao() self.carregar_verbos_muda_negacao + + def carregar_excecoes_plural(self): + try: + self.file = csv.reader(open(self.path+"excecoesPlural.csv")) + except IOError, (errno, strerror): + print "I/O error(%s): %s" % (errno, strerror) + print "carregar_excecoes_plural" + + rows = [] + for row in self.file: + rows.append(row[0].decode("utf-8")) + self.set_exc_plural = set(rows) + def carregar_adverbios_intensidade(self): try: self.file = csv.reader(open(self.path+"adverbiosIntensidade.csv"), delimiter=";") @@ -154,6 +169,9 @@ class LerDicionarios(object): if row[1] != "": self.dic_vb_muda_negacao[row[0].decode("utf-8")] = row[1].decode("utf-8") + def has_excecao_plural(self, token): + return token not in self.set_exc_plural + def has_adverbio_intensidade(self, token): return self.dic_adv_intensidade.has_key(token) -- libgit2 0.21.2