def candidate_skills(self, job_posting):
document = job_posting.text
sentences = self.ie_preprocess(document)
for skill in self.lookup:
len_skill = len(skill.split())
for sent in sentences:
sent = sent.encode('utf-8')
# Exact matching
if len_skill == 1:
sent = sent.decode('utf-8')
if re.search(r'\b' + skill + r'\b', sent, re.IGNORECASE):
yield CandidateSkill(
skill_name=skill,
matched_skill=skill,
confidence=100,
context=sent
)
# Fuzzy matching
else:
ratio = fuzz.partial_ratio(skill, sent)
# You can adjust the partial of matching here:
# 100 => exact matching 0 => no matching
if ratio > 88:
for match in self.fuzzy_matches_in_sentence(skill, sent):
yield match
评论列表
文章目录