使用 Python 中的 RAKE 库从文本中仅提取技术关键字

问题描述 投票:0回答:1

我想使用 rake 从我在 Linkedin 上找到的职位描述中提取技术关键字,如下所示:

input = "In-depth understanding of the Python software development stacks, ecosystems, frameworks and tools such as Numpy, Scipy, Pandas, Dask, spaCy, NLTK, sci-kit-learn and PyTorch.Experience with front-end development using HTML, CSS, and JavaScript.
Familiarity with database technologies such as SQL and NoSQL.Excellent problem-solving ability with solid communication and collaboration skills.
Preferred Skills And QualificationsExperience with popular Python frameworks such as Django, Flask or Pyramid."

我运行此代码,因为它应该返回关键字。

from rake_nltk import Rake

r = Rake()
r.extract_keywords_from_text(input)
keywords = r.get_ranked_phrases_with_scores()

for score, keyword in keywords:
    if len(keyword.split()) == 1:  # Check if the keyword is one word
        print(f"{keyword}: {score}")

但是输出是这样的:

frameworks: 2.0
tools: 1.0
sql: 1.0
spacy: 1.0
scipy: 1.0
sci: 1.0
qualificationsexperience: 1.0
pytorch: 1.0
pyramid: 1.0
pandas: 1.0
numpy: 1.0
nosql: 1.0
nltk: 1.0
learn: 1.0
kit: 1.0
javascript: 1.0
front: 1.0
flask: 1.0
familiarity: 1.0
experience: 1.0
ecosystems: 1.0
django: 1.0
dask: 1.0
css: 1.0

我只是想要工具、技能和框架的明确名称。例如文本中使用的“Numpy”、“Scipy”、“HTML”等,而不是其中找到的每个单词(例如“经验”或“工具”)。

有什么办法可以做到吗?或者我应该只提供所有可能的Python框架和相关技能的列表,然后过滤rake的输出? 如果后一个是解决方案,我怎样才能找到/制作一份完整的列表?

如有任何帮助,我们将不胜感激。

python python-3.x nlp nltk rake
1个回答
0
投票

Rake 是一种与域无关的关键字提取算法,因此您无法使用它来提取与特定域相关的关键字。 您需要将输出过滤为最简单的解决方案,为此,您可以使用类似于下面的链接的不同文档来收集数据并从中列出列表。 https://gist.github.com/pvanfas/8b4518996136d1a5ffc79513b3105033

还尝试其他库(例如 KeyBERT)可能会改善结果。

© www.soinside.com 2019 - 2024. All rights reserved.