caarleexx commited on
Commit
60fb770
·
verified ·
1 Parent(s): 98cec38

Update worker.py

Browse files
Files changed (1) hide show
  1. worker.py +4 -4
worker.py CHANGED
@@ -187,8 +187,8 @@ class ExtratorUltraSimples:
187
  valor = re.sub(r'Ocultar Acórdão Atenção: O texto abaixo representa a transcrição de Acórdão. Eventuais imagens serão suprimidas.Recomenda-se acessar o PDF assinado.', '', valor)
188
  valor = re.sub(r' ---\s*([A-Za-z0-9IVXLCDM]{1,3})\s*­+', r' \n\n#### \1 - ', valor)
189
  valor = re.sub(r' ­ ', ' *** ', valor)
190
- valor = limpar_citacao(valor)
191
- valor = remover_tags_repetidas(valor)
192
 
193
  return chave, valor
194
 
@@ -207,7 +207,7 @@ class ExtratorUltraSimples:
207
  #return re.sub(r' +', ' ', re.sub(r'_\([^)]+\):_|_([^:]+):_', '', texto))
208
  return re.sub(r' +', ' ', re.sub(r'_\([^)]+\):_|_([^:]+):\s+', '', texto))
209
 
210
- def remover_tags_repetidas(t: str, janela=10) -> str:
211
  w = t.split()
212
  i = 0
213
  tag_re = re.compile(r'^_[A-Z0-9_]+:$')
@@ -226,7 +226,7 @@ class ExtratorUltraSimples:
226
 
227
  return ' '.join(w)
228
 
229
- def limpar_citacao(t: str) -> str:
230
  return re.sub(
231
  r'\[([^\]]+)\]',
232
  lambda m: "[" + re.sub(r'_[A-Z0-9_]+:\s*', '', m.group(1)) + "]",
 
187
  valor = re.sub(r'Ocultar Acórdão Atenção: O texto abaixo representa a transcrição de Acórdão. Eventuais imagens serão suprimidas.Recomenda-se acessar o PDF assinado.', '', valor)
188
  valor = re.sub(r' ---\s*([A-Za-z0-9IVXLCDM]{1,3})\s*­+', r' \n\n#### \1 - ', valor)
189
  valor = re.sub(r' ­ ', ' *** ', valor)
190
+ valor = self.limpar_citacao(valor)
191
+ valor = self.remover_tags_repetidas(valor)
192
 
193
  return chave, valor
194
 
 
207
  #return re.sub(r' +', ' ', re.sub(r'_\([^)]+\):_|_([^:]+):_', '', texto))
208
  return re.sub(r' +', ' ', re.sub(r'_\([^)]+\):_|_([^:]+):\s+', '', texto))
209
 
210
+ def remover_tags_repetidas(self, t: str, janela=10) -> str:
211
  w = t.split()
212
  i = 0
213
  tag_re = re.compile(r'^_[A-Z0-9_]+:$')
 
226
 
227
  return ' '.join(w)
228
 
229
+ def limpar_citacao(self, t: str) -> str:
230
  return re.sub(
231
  r'\[([^\]]+)\]',
232
  lambda m: "[" + re.sub(r'_[A-Z0-9_]+:\s*', '', m.group(1)) + "]",