gyrojeff commited on
Commit
5c3dbf6
1 Parent(s): f8472e1

feat: add runtime exclusion list

Browse files
Files changed (1) hide show
  1. font_ds_generate_script.py +5 -1
font_ds_generate_script.py CHANGED
@@ -32,7 +32,7 @@ dataset_path = "./dataset/font_img"
32
  os.makedirs(dataset_path, exist_ok=True)
33
 
34
  unqualified_log_file_name = f"unqualified_font_{time.time()}.txt"
35
-
36
 
37
  fonts, exclusion_rule = load_fonts()
38
  corpus_manager = CorpusGeneratorManager()
@@ -52,6 +52,9 @@ def generate_dataset(dataset_type: str, cnt: int):
52
  if exclusion_rule(font):
53
  print(f"Excluded font: {font.path}")
54
  return
 
 
 
55
 
56
  while True:
57
  try:
@@ -77,6 +80,7 @@ def generate_dataset(dataset_type: str, cnt: int):
77
  return
78
  except UnqualifiedFontException as e:
79
  print(f"SKIPPING Unqualified font: {e.font.path}")
 
80
  with open(unqualified_log_file_name, "a+") as f:
81
  f.write(f"{e.font.path}\n")
82
  return
 
32
  os.makedirs(dataset_path, exist_ok=True)
33
 
34
  unqualified_log_file_name = f"unqualified_font_{time.time()}.txt"
35
+ runtime_exclusion_list = []
36
 
37
  fonts, exclusion_rule = load_fonts()
38
  corpus_manager = CorpusGeneratorManager()
 
52
  if exclusion_rule(font):
53
  print(f"Excluded font: {font.path}")
54
  return
55
+ if font.path in runtime_exclusion_list:
56
+ print(f"Excluded font: {font.path}")
57
+ return
58
 
59
  while True:
60
  try:
 
80
  return
81
  except UnqualifiedFontException as e:
82
  print(f"SKIPPING Unqualified font: {e.font.path}")
83
+ runtime_exclusion_list.append(e.font.path)
84
  with open(unqualified_log_file_name, "a+") as f:
85
  f.write(f"{e.font.path}\n")
86
  return