Nick Canu commited on
Commit
1a371f7
·
1 Parent(s): b81d4c8

update check

Browse files
Files changed (1) hide show
  1. title_generator.py +8 -10
title_generator.py CHANGED
@@ -73,23 +73,21 @@ class Title_Generator:
73
 
74
  def candidate_score(self,candidates,ex_check=None):
75
 
76
- if ex_check != None:
77
- pat = re.compile("((?:" + "|".join(map(re.escape, candidates[0]+[cand.upper() for cand in candidates[0]])) + "|" + "|".join(ex_check) +"))")
78
- desc = re.sub(pat, "__", candidates[1])
79
- else:
80
- pat = re.compile("((?:" + "|".join(map(re.escape, candidates[0]+[cand.upper() for cand in candidates[0]])) + "))")
81
- desc = re.sub(pat, "__", candidates[1])
82
-
83
 
 
 
 
84
  if re.search(re.compile(re.escape("__")), desc):
85
- reg = re.compile("("+"|".join(ex_check) + ")")
86
  hold = candidates[0]
87
  gen_desc = re.sub(re.compile(re.escape("__")),"",desc)
88
  candidates = self.candidate_generator(gen_desc)
89
- next = [cand for cand in candidates[0]+hold if not reg.search(cand)]
90
  candidates = (next, desc)
91
 
92
- #backup load function, will refactor
 
 
 
93
  nlp=spacy.load("en_core_web_md")
94
 
95
  #check for existing games and duplicates
 
73
 
74
  def candidate_score(self,candidates,ex_check=None):
75
 
 
 
 
 
 
 
 
76
 
77
+ pat = re.compile("((?:" + "|".join(map(re.escape, candidates[0]+[cand.upper() for cand in candidates[0]])) + "|" + "|".join(ex_check) +"))")
78
+ desc = re.sub(pat, "__", candidates[1])
79
+
80
  if re.search(re.compile(re.escape("__")), desc):
 
81
  hold = candidates[0]
82
  gen_desc = re.sub(re.compile(re.escape("__")),"",desc)
83
  candidates = self.candidate_generator(gen_desc)
84
+ next = candidates[0]+hold
85
  candidates = (next, desc)
86
 
87
+ reg = re.compile("("+"|".join(ex_check) + ")")
88
+ step = [cand for cand in candidates[0] if not reg.search(cand)]
89
+ candidates = (step,candidates)
90
+
91
  nlp=spacy.load("en_core_web_md")
92
 
93
  #check for existing games and duplicates