freetext.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:skills-ml 作者: workforce-data-initiative 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号