om4r932 commited on
Commit
a7f45db
·
1 Parent(s): 00d0e4e

Update regex

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -34,6 +34,8 @@ app.add_middleware(
34
  allow_headers=["*"],
35
  )
36
 
 
 
37
  def get_text(specification: str, version: str):
38
  """Récupère les bytes du PDF à partir d'une spécification et d'une version."""
39
  doc_id = specification
@@ -264,7 +266,7 @@ def get_file_from_spec_id_version(req: SpecRequest) -> Dict[str, str]:
264
  chapters = []
265
  for line in toc_brut:
266
  x = line.split("\t")
267
- m = re.search(r"^(\d+(?:\.\d+)*)\t[\ \S]+$", line)
268
  if m and any(line in c for c in text[forewords[0]:forewords[1]]):
269
  chapters.append(line)
270
  print(line)
@@ -306,7 +308,7 @@ def get_file_from_spec_id_version(req: SpecRequest) -> Dict:
306
  chapters = []
307
  for line in toc_brut:
308
  x = line.split("\t")
309
- m = re.search(r"^(\d+(?:\.\d+)*)\t[\ \S]+$", line)
310
  if m and any(line in c for c in text[forewords[0]:forewords[1]]):
311
  chapters.append(line)
312
  print(line)
 
34
  allow_headers=["*"],
35
  )
36
 
37
+ regex = r"^(\d+[a-z]?(?:\.\d+)*)\t[\ \S]+$"
38
+
39
  def get_text(specification: str, version: str):
40
  """Récupère les bytes du PDF à partir d'une spécification et d'une version."""
41
  doc_id = specification
 
266
  chapters = []
267
  for line in toc_brut:
268
  x = line.split("\t")
269
+ m = re.search(regex, line)
270
  if m and any(line in c for c in text[forewords[0]:forewords[1]]):
271
  chapters.append(line)
272
  print(line)
 
308
  chapters = []
309
  for line in toc_brut:
310
  x = line.split("\t")
311
+ m = re.search(regex, line)
312
  if m and any(line in c for c in text[forewords[0]:forewords[1]]):
313
  chapters.append(line)
314
  print(line)