【问题标题】:Extracting skills from a job description using TF-IDF or Word2Vec使用 TF-IDF 或 Word2Vec 从职位描述中提取技能
【发布时间】:2020-05-26 00:24:29
【问题描述】:

我有一种情况,我需要从可用的职位描述中提取正在申请工作的特定申请人的技能,并将其完全存储为一个新列。 数据框 X 如下所示:

Job_ID        Job_Desc 
1             Applicant should posses technical capabilities including proficient knowledge of python and SQL
2             Applicant should posses technical capabilities including proficient knowledge of python and SQL and R

结果输出应如下所示:

Job_ID       Skills
1            Python,SQL
2            Python,SQL,R

我已经使用 tf-idf count vectorizer 来获取 Job_Desc 列中最重要的单词,但我仍然无法在输出中获取所需的技能数据。这可以通过 Word2Vec 使用 skip gram 或 CBOW 模型以某种方式实现吗?

我的代码如下所示:

from sklearn.feature_extraction.text import CountVectorizer
cv=CountVectorizer(max_df=0.50)
word_count_vector=cv.fit_transform(X)

from sklearn.feature_extraction.text import TfidfTransformer
tfidf_transformer=TfidfTransformer(smooth_idf=True,use_idf=True)
tfidf_transformer.fit(word_count_vector)

def sort_coo(coo_matrix):
tuples = zip(coo_matrix.col, coo_matrix.data)
return sorted(tuples, key=lambda x: (x[1], x[0]), reverse=True)

def extract_topn_from_vector(feature_names, sorted_items, topn=10):
"""get the feature names and tf-idf score of top n items"""

#use only topn items from vector
sorted_items = sorted_items[:topn]

score_vals = []
feature_vals = []

for idx, score in sorted_items:
    fname = feature_names[idx]

    #keep track of feature name and its corresponding score
    score_vals.append(round(score, 3))
    feature_vals.append(feature_names[idx])

#create a tuples of feature,score
#results = zip(feature_vals,score_vals)
results= {}
for idx in range(len(feature_vals)):
    results[feature_vals[idx]]=score_vals[idx]

return results

feature_names=cv.get_feature_names()
doc=X[0]

tf_idf_vector=tfidf_transformer.transform(cv.transform([doc]))
sorted_items=sort_coo(tf_idf_vector.tocoo())
keywords=extract_topn_from_vector(feature_names,sorted_items,10)
print("\n=====Title=====")
print(X[0])
print("\n===Keywords===")
for k in keywords:
   print(k,keywords[k])

【问题讨论】:

    标签: python-3.x machine-learning word2vec pos-tagger tfidfvectorizer


    【解决方案1】:

    这里是a paper,它提出了一种类似于您建议的方法。

    它建议使用 LSTM + 词嵌入的组合(无论它们来自 word2vec、BERT 等) 由于 TF-IDF 计算重要性的方式,您可能不会得到很好的结果。技能可能只提到一次,而且帖子很短,所以使用的许多其他词也可能只提到一次。

    正如论文所建议的,您可能需要从职位发布中创建一个文本训练数据集,并标记为技能或非技能。

    【讨论】:

      【解决方案2】:

      我想不出 TF-IDF、Word2Vec 或其他简单/无监督算法能够单独识别您需要的“技能”种类的方法。

      您可能需要大量手工整理的技能列表 - 至少,作为一种自动评估旨在提取技能的方法的方法。

      有了精选列表,Word2Vec 之类的内容可能有助于建议同义词、替代形式或相关技能。 (对于已知的技能 X 和文本上的大型 Word2Vec 模型,与 X 相似的术语可能是相似的技能 - 但不能保证,因此您可能仍需要人工审查/管理。)

      使用足够大的数据集将文本映射到结果——例如,候选人描述文本(简历)映射到人工审阅者是选择他们进行面试、雇用他们还是他们在某项工作中取得成功,您也许能够识别出能够高度预测适合某个工作角色的术语。这些术语通常可能是事实上的“技能”。但发现这些相关性可能是一个更大的学习项目。

      【讨论】:

      • 您也可以尝试使用名称实体识别!
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-02-29
      • 2018-05-27
      • 2018-05-07
      • 2021-08-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多