Commit 532686a68952eb03dc6ef8995396147dbffdccff
1 parent
9f3d3d77
Exists in
devel
[TranslationServer] Adiciona condição para carregar todo dicionário de uma vez
Showing
2 changed files
with
7 additions
and
4 deletions
Show diff stats
src/LerDicionarios.py
@@ -51,7 +51,6 @@ class LerDicionarios(object): | @@ -51,7 +51,6 @@ class LerDicionarios(object): | ||
51 | def carregar_dicionarios(self): | 51 | def carregar_dicionarios(self): |
52 | '''Realiza a leitura dos arquivos e atribui à estruturas de dicionários e sets. | 52 | '''Realiza a leitura dos arquivos e atribui à estruturas de dicionários e sets. |
53 | ''' | 53 | ''' |
54 | - print "carregando..." | ||
55 | self.carregar_excecoes_plural() | 54 | self.carregar_excecoes_plural() |
56 | self.carregar_adverbios_intensidade() | 55 | self.carregar_adverbios_intensidade() |
57 | self.carregar_adverbios_tempo() | 56 | self.carregar_adverbios_tempo() |
src/PortGlosa.py
@@ -6,11 +6,15 @@ | @@ -6,11 +6,15 @@ | ||
6 | 6 | ||
7 | #LAViD - Laboratório de Aplicações de Vídeo Digital | 7 | #LAViD - Laboratório de Aplicações de Vídeo Digital |
8 | 8 | ||
9 | -import sys | 9 | +import sys, inspect |
10 | from ThreadTradutor import * | 10 | from ThreadTradutor import * |
11 | from LerDicionarios import * | 11 | from LerDicionarios import * |
12 | 12 | ||
13 | taxas = [] | 13 | taxas = [] |
14 | +dicionario = LerDicionarios() | ||
15 | +classe_pai = inspect.getframeinfo(inspect.getouterframes(inspect.currentframe())[1][0])[0] | ||
16 | +if classe_pai == "TranslationServer.py": | ||
17 | + dicionario.carregar_dicionarios() | ||
14 | 18 | ||
15 | def traduzir(texto, threads=False, taxa_qualidade=False): | 19 | def traduzir(texto, threads=False, taxa_qualidade=False): |
16 | if texto.isspace() or texto == "": | 20 | if texto.isspace() or texto == "": |
@@ -54,10 +58,10 @@ def iniciar_sem_threads(texto, taxa_qualidade): | @@ -54,10 +58,10 @@ def iniciar_sem_threads(texto, taxa_qualidade): | ||
54 | return " ".join(saidas) | 58 | return " ".join(saidas) |
55 | 59 | ||
56 | def quebrar_texto(texto): | 60 | def quebrar_texto(texto): |
61 | + global dicionario | ||
62 | + | ||
57 | if '.' not in texto: | 63 | if '.' not in texto: |
58 | return [texto] | 64 | return [texto] |
59 | - | ||
60 | - dicionario = LerDicionarios() | ||
61 | texto_quebrado = texto.split() | 65 | texto_quebrado = texto.split() |
62 | tamanho_texto_quebrado = len(texto_quebrado) | 66 | tamanho_texto_quebrado = len(texto_quebrado) |
63 | sentencas = [] | 67 | sentencas = [] |