diff --git a/src/PortGlosa.py b/src/PortGlosa.py index 4cab7c2..305033e 100644 --- a/src/PortGlosa.py +++ b/src/PortGlosa.py @@ -18,7 +18,8 @@ taxas = [] def traduzir(texto, log=None, threads=False, taxa_qualidade=False): tradutor.set_level(log) if log != None else tradutor.desativar_logging() - if texto.isspace() or texto == "" or not checar_idioma(texto): + if texto.isspace() or texto == "": + #or not checar_idioma(texto): return "ESCOLHER TEXTO CERTO" elif threads: @@ -71,7 +72,9 @@ def quebrar_texto(texto): lista_texto.append(texto_quebrado[i]) if '.' in texto_quebrado[i]: if not dicionario.has_pron_tratam(texto_quebrado[i].lower()) and i < tamanho_texto_quebrado-1 and texto_quebrado[i+1][0].isupper(): - sentenca = " ".join(lista_texto)[:-1]+"." + sentenca = " ".join(lista_texto) + if not sentenca[-1].isdigit(): + sentenca = sentenca[:-1]+"." sentencas.append(sentenca) lista_texto = [] continue diff --git a/src/alexp.py b/src/alexp.py index 618bdb2..6a6a419 100644 --- a/src/alexp.py +++ b/src/alexp.py @@ -40,7 +40,8 @@ sleep_times=[0.1,0.2] def toqueniza(s): """Decodifica string utilizando utf-8, retornando uma lista de tokens em unicode. """ - decodificada=s.decode("utf-8") + regex = re.compile('[%s]' % re.escape('“”')) + decodificada=regex.sub('-',s.replace("–", "-")).decode("utf-8") return AnotaCorpus.TOK_PORT.tokenize(decodificada) def getAnaliseMorfologica(): -- libgit2 0.21.2