简体   繁体   English

python打印带有常用词或频率词的句子?

[英]python print sentences with common word or frequency words?

i have a data set and i want print all sentences with most frequency word like:我有一个数据集,我想打印所有使用频率最高的单词的句子,例如:

example imagine i have this:例如想象我有这个:

在此处输入图片说明 this is the frequency of my dataset这是我的数据集的频率

在此处输入图片说明

and this is my original dataset这是我的原始数据集

i want print all sentences contain (i) and then delete those extract sentences from dataset我想打印所有包含 (i) 的句子,然后从数据集中删除那些提取的句子

then start with (you) and print all the sentences that contain (you) and then delete (you)然后以(you)开头并打印所有包含(you)的句子,然后删除(you)

but i want set the range between them example start from (frequency 600 to 100) not all of them how to do it但我想设置它们之间的范围,例如从(频率 600 到 100)开始,而不是所有这些怎么做

any idea how to do it ?知道怎么做吗? my dataset is .txt我的数据集是 .txt

i tried this one :我试过这个:

If I understand this right, you want to do a for i in range() for some values from a txt file.如果我理解正确,您想对 txt 文件中的某些值执行 for i in range() 。 I would suggest reading from the file into a dictionary {} so you can use key value pairs to determine when to stop checking.我建议从文件读取到字典 {} 以便您可以使用键值对来确定何时停止检查。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM