Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def extract_keywords(self, text):
text = text.replace('\n\t',' ')
dc = DataCore(text=text, stopword_set=self.stopword_set, windowsSize=self.windowsSize, n=self.n)
dc.build_single_terms_features(features=self.features)
dc.build_mult_terms_features(features=self.features)
resultSet = []
todedup = sorted([cc for cc in dc.candidates.values() if cc.isValid()], key=lambda c: c.H)
if self.dedupLim >= 1.:
return ([ (cand.H, cand.unique_kw) for cand in todedup])[:self.top]
for cand in todedup:
toadd = True
for (h, candResult) in resultSet:
dist = self.dedu_function(cand.unique_kw, candResult.unique_kw)
if dist > self.dedupLim:
toadd = False
break
if toadd: