Python Rake 关键字

问题描述

我正在尝试使用 DF 的 rake 获取前 20 个关键字/短语的列表。我可以创建一个包含每条记录的关键字/短语的新列,如果我使用 get_ranked_phrases,它将只返回 1 个排名短语。无论如何,我是否可以使用为我的数据生成的所有关键短语并获得前 20 名的列表?并包括短语的数量

Title: World's Best Lasagna Recipe - Allrecipes.com,Link: https://www.allrecipes.com/recipe/23600/worlds-best-lasagna/
Title: Best Lasagna - Cafe Delites,Link: https://cafedelites.com/best-lasagna/
Title: The Most Amazing Lasagna Recipe - The Stay At Home Chef,Link: https://thestayathomechef.com/amazing-lasagna-recipe/
Title: The BEST Lasagna Recipe Ever! | The Recipe Critic,Link: https://therecipecritic.com/lasagna-recipe/
Title: The Best Lasagna Recipe EVER | Fail Proof Recipe | Lauren's ...,Link: https://laurenslatest.com/best-lasagna-recipe/
Title: Best Lasagna Recipe - How to Make Lasagna From Scratch,Link: https://www.thepioneerwoman.com/food-cooking/recipes/a11728/best-lasagna-recipe/
Title: Best Lasagna Recipe: How to Make It | Taste of Home,Link: https://www.tasteofhome.com/recipes/best-lasagna/
Title: Easy Homemade Lasagna {Classic Dinner!} - Spend With ...,Link: https://www.spendwithpennies.com/easy-homemade-lasagna/
Title: The Best Lasagna Recipe {Simple & Classic} - Simply Recipes,Link: https://www.simplyrecipes.com/recipes/lasagna/

我知道我可以使用具有 NLTK 功能的 ngrams,但我真的很喜欢 Rake 将单词组合在一起的方式,我认为它对我的数据做得更好,所以我想利用它而不是诉诸 ngrams

最终我希望得到的是这样的:

“这是一个短语”:21 “这是另一个短语”:13 “这是另一个”:8

我想尝试对数据中的关键短语做一些报告,但在真正利用 Rake 输出时遇到问题

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)