Commit 712961efc4eae7033998176453dde09a305bc307
1 parent
4c653c2e
Exists in
devel
Corrige tratamento de palavras compostas
Showing
1 changed file
with
1 additions
and
2 deletions
Show diff stats
src/AplicaSinonimos.py
| ... | ... | @@ -62,12 +62,11 @@ class AplicaSinonimos(object): |
| 62 | 62 | for p in palavras_compostas: |
| 63 | 63 | for m in re.finditer(p, sentenca_corrigida): |
| 64 | 64 | first = "_" if m.start() == 0 else sentenca_corrigida[m.start()-1] |
| 65 | - last = "_" if m.end() == len(sentenca_corrigida)-1 else sentenca_corrigida[m.end()] | |
| 65 | + last = "_" if m.end() == len(sentenca_corrigida) else sentenca_corrigida[m.end()-1] | |
| 66 | 66 | if first == "_" and last == "_": |
| 67 | 67 | sentenca_corrigida = sentenca_corrigida.replace(p, p.replace("_", "#*#")) |
| 68 | 68 | return sentenca_corrigida.replace("_", " ").replace("#*#", "_") |
| 69 | 69 | |
| 70 | - | |
| 71 | 70 | def carregar_palavras_compostas(self): |
| 72 | 71 | path = self.localizar_arquivo_palavras_compostas() |
| 73 | 72 | return set(open(path).read().decode('utf-8').split()) | ... | ... |