关于文本的关键词提取方法分为有监督、半监督和无监督三种:
参考链接:文本关键词提取算法解析 - 知乎 (zhihu.com)
基于统计特征的关键词抽取,比如td-idf
基于词图模型的关键词抽取,比如textrank
基于主题模型的关键词抽取,比如zero-shot-clasification
常见的算法效果如下,GPT的效果更差,没有列出来

rake算法流程
a. 预处理
首先,删除停用词。
b. 生成候选词
在停顿词位置和标点处对文档进行分割,得到内容词。不包含停用词的连续共现词被视作候选关键词。

c. 候选词打分
接下来,计算所有内容词的频率。这样就能得到频繁出现的词。
rake算法的缺点如下:
yake提取关键词代码如下:
- import yake
-
- text = """no a good product very crooked this is not a good product not sturdy or striaght when assembled instruction where not easy to follow had neighbor help me he agreed this is not good product"""
-
-
-
- kw_extractor = yake.KeywordExtractor()
- keywords = kw_extractor.extract_keywords(text)
-
- for kw in keywords:
- print(kw)