前言:
当前我们对“python怎么统计文本中的字频”大概比较重视,小伙伴们都想要剖析一些“python怎么统计文本中的字频”的相关知识。那么小编同时在网络上汇集了一些对于“python怎么统计文本中的字频””的相关知识,希望咱们能喜欢,你们快快来学习一下吧!编者按:
上学时听过山师王志民先生一场讲座,说每个人不论干什么,都应该学习国学(原谅我学了计算机专业)!王先生讲得很是吸引我这个工科男,可能比我的后来的那些同学听课还要认真些,当然一方面是兴趣、一方面是跨了学科听课,内容引人入胜,主要还是我懂得太少了,哈!我记得当时讲座的主题是有关孔子与齐鲁大地的关系,也正是那场讲座让我下决心跨学院选修了《中国古代思想文化史研究》,才让我对于诸子百家思想有了更深的认识,教授们轮番上阵,让我们学习到我们中华民族先贤智慧。也认识了历史学和中国哲学专业的同学,其中还有我至今还在联系的挚友,了解了不同学科的内容,了解到了他们的风采,过了把假装文科生的瘾!确实,不同专业是以完全不同的方式和内容在塑造人!
闲言少续,书接正文,有次一位老师讲到学界有争论《论语》中是提倡“仁”多一点还是“礼”多一点,谈了一些学界同行的论证,其中就有字的出现次数的问题,本文可以说用计算机语言,编程实现回答其中的这个小问题。
下面开始,先从网上找到并下载《论语》这本书的一个原文txt版本,下载下来的这个版本是从“卷一 学而第一”到“卷十 尧曰第二十”,不过内容我没有做过多的校对。然后开始写代码,全部代码如下:
with open('lunyu.txt',encoding='utf-8') as f: ly = f.read()def fun(x,y): if y in x: x[y]=x[y]+1 else: x[y]=1 return xresult=reduce(fun,list(ly),{})print(sorted(result.items(),key=(lambda x:x[1]),reverse=True))
参考代码、释文以及执行结果附在最后。从结果中可见“仁”字出现了110次,“礼”字出现了75次。
怎么样?你是不是感受到那句“人生苦短,我用Python”了呢?
下面继续一步步掌握以上所用内容,为你所用!
以上10行代码中重点用到了reduce函数,还有其它的内容比如读取文件、利用字典这个数据结构,还有sorted排序方法,让输出结果有续排列可读性强。下面我们对其中的reduce函数进行展开。
在上一次分享《Python中的常用内置对象之map对象》中我们谈到,mapreduce是大数据的计算模型,分别是任务分发和整合的过程,reduce对象的定义为:
functools.reduce(function, iterable[, initializer])
将两个参数的 function 从左至右积累地应用到 iterable 的条目,以便将该可迭代对象缩减为单一的值。例如,reduce(lambda x, y: x+y, [1, 2, 3, 4, 5]) 是计算 ((((1+2)+3)+4)+5) 的值。左边的参数 x 是积累值而右边的参数 y 则是来自 iterable 的更新值。如果存在可选项 initializer,它会被放在参与计算的可迭代对象的条目之前,并在可迭代对象为空时作为默认值。如果没有给出 initializer 并且 iterable 仅包含一个条目,则将返回第一项。
大致相当于:
def reduce(function, iterable, initializer=None): it = iter(iterable) if initializer is None: value = next(it) else: value = initializer for element in it: value = function(value, element) return value
实战1:计算1到100的和
参考代码1:
from functools import reducel = list(range(1,101))def f_add(x,y): return x+ynum = reduce(f_add,l)print(num)
参考代码2:
from functools import reduceprint(reduce((lambda x,y:x+y),list(range(1,101))))
输出结果为:5050
实战2:计算1到100的平方和
参考代码1:
from functools import reduce#生成1到100这100个数放在列表中l = list(range(1,101))#获取每个数的平方放在列表中num = list(map((lambda x:x**2),l))def f_add(x,y): return x+y #计算平方和result = reduce(f_add,num)print(result)
参考代码2:
from functools import reduceprint(reduce((lambda x,y:x+y),list(map((lambda x:x**2),list(range(1,101))))))
结果:338350
实战3:拼接字符串
请将以下字符串拼接在一起,连成一个字符串。
'\t', '人', '民', '解', '放', '军', '占', '领', '南', '京', ' ', '\n', '\t', '\t', '毛', '泽', '东', ' ', '\n', '钟', '山', '风', '雨', '起', '苍', '黄', ',', '百', '万', '雄', '师', '过', '大', '江', '。', '\n', '虎', '踞', '龙', '盘', '今', '胜', '昔', ',', '天', '翻', '地', '覆', '慨', '而', '慷', '。', '\n', '宜', '将', '剩', '勇', '追', '穷', '寇', ',', '不', '可', '沽', '名', '学', '霸', '王', '。', '\n', '天', '若', '有', '情', '天', '亦', '老', ',', '人', '间', '正', '道', '是', '沧', '桑', '。', ‘\n’
参考代码1:
l=['\t', '人', '民', '解', '放', '军', '占', '领', '南', '京', ' ', '\n', '\t', '\t', '毛', '泽', '东', ' ', '\n', '钟', '山', '风', '雨', '起', '苍', '黄', ',', '百', '万', '雄', '师', '过', '大', '江', '。', '\n', '虎', '踞', '龙', '盘', '今', '胜', '昔', ',', '天', '翻', '地', '覆', '慨', '而', '慷', '。', '\n', '宜', '将', '剩', '勇', '追', '穷', '寇', ',', '不', '可', '沽', '名', '学', '霸', '王', '。', '\n', '天', '若', '有', '情', '天', '亦', '老', ',', '人', '间', '正', '道', '是', '沧', '桑', '。', '\n']poem2 = reduce(f_add,l)print(poem2)
输出结果:
人民解放军占领南京
毛泽东
钟山风雨起苍黄,百万雄师过大江。
虎踞龙盘今胜昔,天翻地覆慨而慷。
宜将剩勇追穷寇,不可沽名学霸王。
天若有情天亦老,人间正道是沧桑。
当reduce接收到第三个参数时,则这个参数作为第一次迭代的第一个元素使用。
reduce()还可以接收第3个可选参数,作为计算的初始值。
例:
如果把初始值设为100,计算:
def f_add(x,y): return x+y print((reduce(f_add, [1, 3, 5, 7, 9], 100)))
结果将变为125。
因为第一轮计算是:计算初始值和第一个元素:f(100, 1),结果为101。
思考:统计词频
请仿照代码,统计以下字符串的词频。
人民解放军占领南京
毛泽东
钟山风雨起苍黄,百万雄师过大江。
虎踞龙盘今胜昔,天翻地覆慨而慷。
宜将剩勇追穷寇,不可沽名学霸王。
天若有情天亦老,人间正道是沧桑。
仿照代码:
str="an apple a banana three apple a desk"list=str.split(' ')def fun(x,y): if y in x: x[y]=x[y]+1 else: x[y]=1 return xresult=reduce(fun,list,{})#输出结果是>>>{'a': 2, 'apple': 2, 'three': 1, 'an': 1, 'desk': 1, 'banana': 1}
参考答案之一:
poem = '\t人民解放军占领南京 \n\t\t毛泽东 \n钟山风雨起苍黄,百万雄师过大江。\n虎踞龙盘今胜昔,天翻地覆慨而慷。\n宜将剩勇追穷寇,不可沽名学霸王。\n天若有情天亦老,人间正道是沧桑。\n'l = list(poem)def fun(x,y): if y in x: x[y]=x[y]+1 else: x[y]=1 return xresult=reduce(fun,l,{})print(result)#还可以对结果进行排序print(sorted(result.items(),key=(lambda x:x[1]),reverse=True))
结果请去小试一下!
最后让我们回到题目所提出的问题,如何用Python统计《论语》中每个字的出现次数?参考代码及释文如下:
‘’’打开与py文件同目录的《论语》文本文件lunyu.txt,并读取#到文件中以utf-8的编码格式读取文件,这里的encodeing参数最#好指定好,不指定采用默认值的话会报错。’’’
with open('lunyu.txt',encoding='utf-8') as f: ly = f.read() #定义一个函数,来生成字典数据,这个设计非常巧妙,非常Pythonic。def fun(x,y): if y in x: x[y]=x[y]+1 else: x[y]=1 return x#利用reduce函数求得每个字符的出现次数,当然标点符号也在统计之列,也可以采取进一步的启用停用词的方式把它们屏蔽掉result=reduce(fun,list(ly),{})#对结果按出现次数降序排序后输出。print(sorted(result.items(),key=(lambda x:x[1]),reverse=True))
怎么样,你是不是学会了呢?
好了,本次分享就到这里,You can learn anything!
执行结果如下:
[(' ', 2089), (',', 1489), ('\n', 1104), ('。', 1054), ('子', 976), (':', 788), ('“', 766), ('”', 765), ('曰', 758), ('之', 613), ('不', 583), ('也', 533), ('而', 345), ('?', 305), ('其', 270), ('人', 219), ('者', 219), ('以', 211), ('有', 200), ('于', 183), ('矣', 181), ('为', 171), ('君', 160), ('乎', 158), ('可', 156), ('如', 154), ('!', 146), ('与', 144), ('无', 131), ('言', 130), ('则', 124), ('问', 121), ('知', 118), (';', 118), ('何', 118), ('吾', 113), ('仁', 110), ('夫', 105), ('道', 89), ('焉', 88), ('行', 82), ('谓', 78), ('必', 75), ('礼', 75), ('三', 74), ('孔', 74), ('斯', 71), ('能', 69), ('见', 67), ('学', 66), ('、', 63), ('事', 61), ('哉', 61), ('是', 60), ('闻', 59), ('公', 59), ('未', 57), ('路', 54), ('好', 53), ('我', 53), ('在', 51), ('得', 50), ('大', 50), ('所', 50), ('已', 50), ('民', 49), ('小', 49), ('天', 49), ('乐', 48), ('邦', 48), ('亦', 47), ('使', 47), ('下', 46), ('贡', 44), ('欲', 44), ('政', 43), ('诸', 43), ('从', 43), ('文', 42), ('食', 42), ('善', 42), ('后', 41), ('德', 40), ('求', 39), ('对', 39), ('恶', 39), ('信', 38), ('’', 38), ('死', 38), ('然', 38), ('一', 36), ('‘', 36), ('由', 35), ('仲', 35), ('十', 33), ('非', 33), ('出', 32), ('过', 32), ('虽', 31), ('足', 31), ('居', 30), ('夏', 29), ('父', 29), ('己', 29), ('尔', 29), ('及', 29), ('予', 28), ('上', 27), ('色', 27), ('友', 27), ('张', 27), ('季', 27), ('成', 27), ('远', 26), ('立', 26), ('齐', 26), ('今', 26), ('中', 26), ('臣', 26), ('贤', 25), ('思', 25), ('义', 24), ('正', 24), ('命', 24), ('伯', 24), ('曾', 23), ('门', 23), ('敢', 23), ('犹', 23), ('生', 22), ('日', 22), ('敬', 22), ('四', 22), ('难', 22), ('直', 22), ('丧', 22), ('颜', 22), ('卷', 21), ('说', 21), ('自', 21), ('用', 21), ('周', 21), ('\u3000', 20), ('第', 20), ('年', 20), ('先', 20), ('告', 20), ('怨', 20), ('达', 20), ('孝', 19), ('弟', 19), ('至', 19), ('二', 19), ('五', 19), ('师', 19), ('女', 19), ('多', 19), ('氏', 19), ('忠', 18), ('疾', 18), ('服', 18), ('冉', 18), ('将', 18), ('士', 18), ('莫', 18), ('丘', 18), ('入', 17), ('志', 17), ('耻', 17), ('失', 17), ('安', 17), ('富', 17), ('赐', 17), ('患', 17), ('百', 17), ('孙', 17), ('回', 17), ('宰', 17), ('朝', 17), ('渊', 17), ('身', 16), ('若', 16), ('云', 16), ('或', 16), ('勇', 16), ('孰', 16), ('叔', 16), ('方', 15), ('乱', 15), ('唯', 15), ('忧', 15), ('马', 15), ('皆', 15), ('故', 15), ('世', 15), ('语', 15), ('又', 15), ('衣', 15), ('改', 14), ('美', 14), ('诗', 14), ('六', 14), ('违', 14), ('祭', 14), ('武', 14), ('游', 14), ('举', 14), ('既', 14), ('执', 14), ('进', 14), ('称', 14), ('众', 13), ('力', 13), ('勿', 13), ('恭', 13), ('退', 13), ('去', 13), ('管', 13), ('请', 13), ('党', 13), ('易', 12), ('且', 12), ('哀', 12), ('益', 12), ('取', 12), ('古', 12), ('鲁', 12), ('长', 12), ('适', 12), ('惠', 12), ('南', 12), ('陈', 12), ('乡', 12), ('谁', 12), ('时', 11), ('作', 11), ('终', 11), ('归', 11), ('异', 11), ('观', 11), ('近', 11), ('往', 11), ('孟', 11), ('樊', 11), ('寡', 11), ('奚', 11), ('兄', 11), ('家', 11), ('夷', 11), ('亡', 11), ('利', 11), ('躬', 11), ('明', 11), ('修', 11), ('卫', 11), ('来', 10), ('令', 10), ('国', 10), ('母', 10), ('固', 10), ('惑', 10), ('七', 10), ('迟', 10), ('劳', 10), ('相', 10), ('辟', 10), ('泰', 10), ('尝', 10), ('久', 10), ('苟', 10), ('次', 10), ('佞', 10), ('室', 10), ('月', 10), ('畏', 10), ('朋', 9), ('谋', 9), ('乘', 9), ('爱', 9), ('亲', 9), ('致', 9), ('复', 9), ('宗', 9), ('敏', 9), ('贫', 9), ('蔽', 9), ('愚', 9), ('山', 9), ('同', 9), ('反', 9), ('怀', 9), ('老', 9), ('九', 9), ('厌', 9), ('隐', 9), ('兴', 9), ('召', 9), ('杀', 9), ('和', 8), ('贵', 8), ('骄', 8), ('视', 8), ('康', 8), ('车', 8), ('庙', 8), ('名', 8), ('加', 8), ('位', 8), ('内', 8), ('容', 8), ('废', 8), ('仕', 8), ('听', 8), ('狂', 8), ('简', 8), ('少', 8), ('质', 8), ('圣', 8), ('舜', 8), ('病', 8), ('桓', 8), ('岂', 8), ('止', 8), ('受', 8), ('慎', 7), ('让', 7), ('王', 7), ('始', 7), ('譬', 7), ('比', 7), ('枉', 7), ('教', 7), ('殷', 7), ('八', 7), ('升', 7), ('神', 7), ('惧', 7), ('赤', 7), ('裘', 7), ('伐', 7), ('弓', 7), ('毋', 7), ('牛', 7), ('费', 7), ('变', 7), ('博', 7), ('司', 7), ('荡', 7), ('笃', 7), ('才', 7), ('危', 7), ('冕', 7), ('鲜', 6), ('节', 6), ('俭', 6), ('没', 6), ('辱', 6), ('切', 6), ('免', 6), ('心', 6), ('器', 6), ('临', 6), ('庄', 6), ('施', 6), ('损', 6), ('雍', 6), ('宁', 6), ('弗', 6), ('贾', 6), ('罪', 6), ('尽', 6), ('战', 6), ('里', 6), ('处', 6), ('约', 6), ('各', 6), ('治', 6), ('墙', 6), ('臧', 6), ('旧', 6), ('微', 6), ('愿', 6), ('辞', 6), ('舍', 6), ('闵', 6), ('手', 6), ('动', 6), ('尧', 6), ('识', 6), ('肉', 6), ('饭', 6), ('期', 6), ('姓', 6), ('气', 6), ('谷', 6), ('巍', 6), ('拜', 6), ('趋', 6), ('末', 6), ('怡', 6), ('徒', 6), ('尼', 6), ('本', 5), ('巧', 5), ('千', 5), ('余', 5), ('主', 5), ('厚', 5), ('抑', 5), ('温', 5), ('因', 5), ('刑', 5), ('酒', 5), ('诲', 5), ('禄', 5), ('阙', 5), ('书', 5), ('鬼', 5), ('堂', 5), ('放', 5), ('射', 5), ('饮', 5), ('笑', 5), ('兮', 5), ('征', 5), ('谏', 5), ('木', 5), ('间', 5), ('盖', 5), ('几', 5), ('喜', 5), ('数', 5), ('妻', 5), ('宾', 5), ('寝', 5), ('刚', 5), ('尹', 5), ('弃', 5), ('他', 5), ('希', 5), ('侍', 5), ('华', 5), ('骞', 5), ('胜', 5), ('倦', 5), ('甚', 5), ('衰', 5), ('歌', 5), ('忘', 5), ('恒', 5), ('宿', 5), ('厉', 5), ('鄙', 5), ('夺', 5), ('任', 5), ('守', 5), ('禹', 5), ('玉', 5), ('阶', 5), ('坐', 5), ('鲤', 5), ('鼓', 5), ('贼', 5), ('侯', 5), ('景', 5), ('草', 5), ('矜', 5), ('颛', 5), ('臾', 5), ('戒', 5), ('阳', 5), ('犯', 4), ('省', 4), ('交', 4), ('重', 4), ('威', 4), ('共', 4), ('踰', 4), ('御', 4), ('葬', 4), ('养', 4), ('发', 4), ('察', 4), ('殆', 4), ('攻', 4), ('干', 4), ('错', 4), ('舞', 4), ('旅', 4), ('揖', 4), ('商', 4), ('祷', 4), ('羊', 4), ('伤', 4), ('官', 4), ('宽', 4), ('择', 4), ('贱', 4), ('疏', 4), ('海', 4), ('章', 4), ('恐', 4), ('弒', 4), ('高', 4), ('左', 4), ('幸', 4), ('粟', 4), ('果', 4), ('艺', 4), ('偃', 4), ('水', 4), ('觚', 4), ('欺', 4), ('畔', 4), ('述', 4), ('军', 4), ('雅', 4), ('童', 4), ('西', 4), ('鸟', 4), ('昔', 4), ('弘', 4), ('宫', 4), ('绝', 4), ('匡', 4), ('前', 4), ('沽', 4), ('待', 4), ('困', 4), ('便', 4), ('侃', 4), ('誾', 4), ('鱼', 4), ('席', 4), ('杖', 4), ('东', 4), ('风', 4), ('恸', 4), ('瑟', 4), ('庶', 4), ('崇', 4), ('硁', 4), ('偲', 4), ('谅', 4), ('报', 4), ('穷', 4), ('声', 4), ('柳', 4), ('群', 4), ('毁', 4), ('逸', 4), ('习', 3), ('愠', 3), ('谨', 3), ('竭', 3), ('饱', 3), ('就', 3), ('谄', 3), ('耳', 3), ('顺', 3), ('新', 3), ('罔', 3), ('端', 3), ('疑', 3), ('尤', 3), ('悔', 3), ('惟', 3), ('继', 3), ('庭', 3), ('忍', 3), ('彻', 3), ('戚', 3), ('争', 3), ('素', 3), ('每', 3), ('定', 3), ('社', 3), ('摄', 3), ('绎', 3), ('韶', 3), ('尚', 3), ('参', 3), ('贯', 3), ('邻', 3), ('屡', 3), ('雕', 3), ('邑', 3), ('望', 3), ('申', 3), ('产', 3), ('平', 3), ('蔡', 3), ('崔', 3), ('讼', 3), ('面', 3), ('乃', 3), ('短', 3), ('原', 3), ('陋', 3), ('野', 3), ('史', 3), ('逝', 3), ('矢', 3), ('窃', 3), ('启', 3), ('暴', 3), ('虎', 3), ('河', 3), ('诺', 3), ('叶', 3), ('洁', 3), ('巫', 3), ('猛', 3), ('履', 3), ('貌', 3), ('慢', 3), ('功', 3), ('虞', 3), ('分', 3), ('空', 3), ('凤', 3), ('瞽', 3), ('忽', 3), ('循', 3), ('闲', 3), ('诈', 3), ('夜', 3), ('地', 3), ('匹', 3), ('狐', 3), ('权', 3), ('似', 3), ('勃', 3), ('鞠', 3), ('降', 3), ('授', 3), ('享', 3), ('亵', 3), ('当', 3), ('羔', 3), ('冠', 3), ('量', 3), ('俟', 3), ('椁', 3), ('噫', 3), ('货', 3), ('稷', 3), ('皙', 3), ('哂', 3), ('会', 3), ('克', 3), ('讱', 3), ('独', 3), ('润', 3), ('肤', 3), ('愬', 3), ('兵', 3), ('(', 3), (')', 3), ('盗', 3), ('虑', 3), ('忿', 3), ('稼', 3), ('速', 3), ('彼', 3), ('优', 3), ('灵', 3), ('寮', 3), ('肆', 3), ('击', 3), ('磬', 3), ('舆', 3), ('郑', 3), ('火', 3), ('血', 3), ('桀', 3), ('溺', 3), ('拒', 3), ('尊', 3), ('帝', 3), ('务', 2), ('传', 2), ('惮', 2), ('追', 2), ('禽', 2), ('磨', 2), ('犬', 2), ('别', 2), ('馔', 2), ('私', 2), ('廋', 2), ('害', 2), ('劝', 2), ('佾', 2), ('穆', 2), ('林', 2), ('奢', 2), ('狄', 2), ('目', 2), ('宋', 2), ('禘', 2), ('指', 2), ('媚', 2), ('获', 2), ('代', 2), ('郁', 2), ('关', 2), ('雎', 2), ('淫', 2), ('松', 2), ('柏', 2), ('栗', 2), ('遂', 2), ('树', 2), ('塞', 2), ('两', 2), ('坫', 2), ('纯', 2), ('颠', 2), ('议', 2), ('土', 2), ('恕', 2), ('喻', 2), ('逮', 2), ('讷', 2), ('孤', 2), ('冶', 2), ('口', 2), ('浮', 2), ('束', 2), ('客', 2), ('愈', 2), ('昼', 2), ('枨', 2), ('性', 2), ('晏', 2), ('清', 2), ('再', 2), ('乞', 2), ('盍', 2), ('轻', 2), ('敝', 2), ('迁', 2), ('川', 2), ('巷', 2), ('儒', 2), ('城', 2), ('灭', 2), ('祝', 2), ('鮀', 2), ('户', 2), ('彬', 2), ('徙', 2), ('夭', 2), ('愤', 2), ('隅', 2), ('侧', 2), ('哭', 2), ('藏', 2), ('图', 2), ('虚', 2), ('盈', 2), ('败', 2), ('昭', 2), ('吴', 2), ('只', 2), ('绞', 2), ('兢', 2), ('深', 2), ('薄', 2), ('鸣', 2), ('豆', 2), ('实', 2), ('毅', 2), ('吝', 2), ('挚', 2), ('洋', 2), ('悾', 2), ('唐', 2), ('盛', 2), ('妇', 2), ('沟', 2), ('罕', 2), ('纵', 2), ('试', 2), ('叩', 2), ('裳', 2), ('喟', 2), ('叹', 2), ('仰', 2), ('弥', 2), ('钻', 2), ('坚', 2), ('瞻', 2), ('篑', 2), ('覆', 2), ('惜', 2), ('秀', 2), ('法', 2), ('帅', 2), ('貉', 2), ('诵', 2), ('岁', 2), ('恂', 2), ('踧', 2), ('踖', 2), ('躩', 2), ('右', 2), ('翼', 2), ('顾', 2), ('屏', 2), ('圭', 2), ('缩', 2), ('愉', 2), ('饰', 2), ('紫', 2), ('缁', 2), ('玄', 2), ('馁', 2), ('割', 2), ('市', 2), ('瓜', 2), ('馈', 2), ('首', 2), ('绅', 2), ('狎', 2), ('式', 2), ('负', 2), ('绥', 2), ('白', 2), ('亿', 2), ('论', 2), ('饥', 2), ('点', 2), ('春', 2), ('浴', 2), ('雩', 2), ('承', 2), ('浸', 2), ('谮', 2), ('驷', 2), ('革', 2), ('辨', 2), ('慝', 2), ('选', 2), ('汤', 2), ('赦', 2), ('罚', 2), ('圃', 2), ('情', 2), ('合', 2), ('诚', 2), ('斗', 2), ('狷', 2), ('备', 2), ('即', 2), ('宪', 2), ('讨', 2), ('绰', 2), ('要', 2), ('谲', 2), ('纠', 2), ('到', 2), ('蘧', 2), ('栖', 2), ('荷', 2), ('幼', 2), ('并', 2), ('工', 2), ('誉', 2), ('耕', 2), ('莅', 2), ('蹈', 2), ('某', 2), ('均', 2), ('崩', 2), ('侮', 2), ('亢', 2), ('遇', 2), ('涂', 2), ('鸡', 2), ('佛', 2), ('肸', 2), ('兽', 2), ('朱', 2), ('流', 2), ('黜', 2), ('楚', 2), ('沮', 2), ('津', 2), ('滔', 2), ('丈', 2), ('伦', 2), ('连', 2), ('俨', 2), ('皇', 2), ('朕', 2), ('万', 2), ('贪', 2), ('\ufeff', 1), ('泛', 1), ('良', 1), ('磋', 1), ('琢', 1), ('北', 1), ('辰', 1), ('星', 1), ('邪', 1), ('格', 1), ('矩', 1), ('懿', 1), ('慈', 1), ('輗', 1), ('軏', 1), ('维', 1), ('救', 1), ('呜', 1), ('呼', 1), ('倩', 1), ('盼', 1), ('绚', 1), ('绘', 1), ('起', 1), ('杞', 1), ('献', 1), ('灌', 1), ('示', 1), ('掌', 1), ('奥', 1), ('灶', 1), ('监', 1), ('鄹', 1), ('皮', 1), ('科', 1), ('朔', 1), ('饩', 1), ('咎', 1), ('翕', 1), ('皦', 1), ('仪', 1), ('封', 1), ('铎', 1), ('造', 1), ('沛', 1), ('夕', 1), ('缧', 1), ('绁', 1), ('戮', 1), ('瑚', 1), ('琏', 1), ('给', 1), ('憎', 1), ('漆', 1), ('开', 1), ('桴', 1), ('材', 1), ('赋', 1), ('带', 1), ('朽', 1), ('粪', 1), ('杇', 1), ('诛', 1), ('藻', 1), ('梲', 1), ('斐', 1), ('裁', 1), ('念', 1), ('醯', 1), ('匿', 1), ('憾', 1), ('桑', 1), ('怒', 1), ('贰', 1), ('釜', 1), ('庾', 1), ('秉', 1), ('肥', 1), ('急', 1), ('犁', 1), ('骍', 1), ('角', 1), ('汶', 1), ('牖', 1), ('箪', 1), ('瓢', 1), ('堪', 1), ('画', 1), ('澹', 1), ('台', 1), ('径', 1), ('奔', 1), ('殿', 1), ('策', 1), ('静', 1), ('寿', 1), ('井', 1), ('陷', 1), ('否', 1), ('庸', 1), ('济', 1), ('彭', 1), ('默', 1), ('讲', 1), ('燕', 1), ('梦', 1), ('据', 1), ('依', 1), ('悱', 1), ('冯', 1), ('鞭', 1), ('味', 1), ('曲', 1), ('肱', 1), ('枕', 1), ('怪', 1), ('魋', 1), ('钓', 1), ('纲', 1), ('弋', 1), ('互', 1), ('保', 1), ('诔', 1), ('坦', 1), ('葸', 1), ('遗', 1), ('偷', 1), ('冰', 1), ('倍', 1), ('笾', 1), ('存', 1), ('校', 1), ('托', 1), ('尺', 1), ('寄', 1), ('侗', 1), ('焕', 1), ('际', 1), ('菲', 1), ('黻', 1), ('卑', 1), ('洫', 1), ('麻', 1), ('意', 1), ('兹', 1), ('牢', 1), ('诱', 1), ('罢', 1), ('卓', 1), ('韫', 1), ('匮', 1), ('颂', 1), ('卿', 1), ('勉', 1), ('惰', 1), ('苗', 1), ('巽', 1), ('缊', 1), ('袍', 1), ('忮', 1), ('寒', 1), ('棣', 1), ('偏', 1), ('廷', 1), ('摈', 1), ('襜', 1), ('阈', 1), ('息', 1), ('等', 1), ('逞', 1), ('觌', 1), ('绀', 1), ('緅', 1), ('红', 1), ('暑', 1), ('袗', 1), ('絺', 1), ('绤', 1), ('表', 1), ('麑', 1), ('黄', 1), ('袂', 1), ('佩', 1), ('帷', 1), ('吊', 1), ('吉', 1), ('布', 1), ('半', 1), ('精', 1), ('脍', 1), ('细', 1), ('饐', 1), ('餲', 1), ('臭', 1), ('饪', 1), ('酱', 1), ('脯', 1), ('撤', 1), ('姜', 1), ('菜', 1), ('羹', 1), ('傩', 1), ('阼', 1), ('送', 1), ('药', 1), ('厩', 1), ('焚', 1), ('腥', 1), ('熟', 1), ('荐', 1), ('畜', 1), ('拖', 1), ('驾', 1), ('太', 1), ('殡', 1), ('尸', 1), ('凶', 1), ('版', 1), ('迅', 1), ('雷', 1), ('烈', 1), ('翔', 1), ('集', 1), ('梁', 1), ('雌', 1), ('雉', 1), ('嗅', 1), ('助', 1), ('昆', 1), ('棺', 1), ('府', 1), ('仍', 1), ('聚', 1), ('敛', 1), ('附', 1), ('柴', 1), ('喭', 1), ('殖', 1), ('践', 1), ('迹', 1), ('兼', 1), ('具', 1), ('读', 1), ('率', 1), ('馑', 1), ('甫', 1), ('铿', 1), ('撰', 1), ('沂', 1), ('咏', 1), ('疚', 1), ('棘', 1), ('舌', 1), ('豹', 1), ('片', 1), ('折', 1), ('狱', 1), ('赏', 1), ('皋', 1), ('陶', 1), ('伊', 1), ('辅', 1), ('迂', 1), ('措', 1), ('农', 1), ('须', 1), ('襁', 1), ('专', 1), ('荆', 1), ('完', 1), ('仆', 1), ('残', 1), ('莒', 1), ('攘', 1), ('证', 1), ('族', 1), ('筲', 1), ('算', 1), ('医', 1), ('羞', 1), ('占', 1), ('戎', 1), ('羿', 1), ('奡', 1), ('舟', 1), ('俱', 1), ('答', 1), ('裨', 1), ('谌', 1), ('创', 1), ('羽', 1), ('骈', 1), ('齿', 1), ('赵', 1), ('魏', 1), ('滕', 1), ('薛', 1), ('卞', 1), ('防', 1), ('晋', 1), ('霸', 1), ('被', 1), ('衽', 1), ('经', 1), ('渎', 1), ('僎', 1), ('圉', 1), ('怍', 1), ('沐', 1), ('暇', 1), ('逆', 1), ('觉', 1), ('亩', 1), ('骥', 1), ('石', 1), ('晨', 1), ('蒉', 1), ('浅', 1), ('揭', 1), ('阴', 1), ('薨', 1), ('总', 1), ('冢', 1), ('壤', 1), ('胫', 1), ('俎', 1), ('粮', 1), ('滥', 1), ('蛮', 1), ('貊', 1), ('州', 1), ('倚', 1), ('衡', 1), ('辂', 1), ('责', 1), ('慧', 1), ('借', 1), ('贞', 1), ('类', 1), ('蒙', 1), ('域', 1), ('列', 1), ('持', 1), ('扶', 1), ('兕', 1), ('柙', 1), ('龟', 1), ('椟', 1), ('倾', 1), ('离', 1), ('析', 1), ('戈', 1), ('萧', 1), ('陪', 1), ('柔', 1), ('佚', 1), ('宴', 1), ('愆', 1), ('躁', 1), ('壮', 1), ('聪', 1), ('探', 1), ('饿', 1), ('豚', 1), ('宝', 1), ('迷', 1), ('亟', 1), ('移', 1), ('弦', 1), ('莞', 1), ('刀', 1), ('戏', 1), ('扰', 1), ('牟', 1), ('磷', 1), ('涅', 1), ('匏', 1), ('系', 1), ('迩', 1), ('帛', 1), ('钟', 1), ('荏', 1), ('穿', 1), ('窬', 1), ('廉', 1), ('戾', 1), ('物', 1), ('孺', 1), ('悲', 1), ('坏', 1), ('燧', 1), ('稻', 1), ('锦', 1), ('旨', 1), ('甘', 1), ('通', 1), ('弈', 1), ('讪', 1), ('窒', 1), ('徼', 1), ('讦', 1), ('箕', 1), ('奴', 1), ('接', 1), ('耦', 1), ('耰', 1), ('辍', 1), ('怃', 1), ('莜', 1), ('体', 1), ('勤', 1), ('植', 1), ('芸', 1), ('拱', 1), ('黍', 1), ('亚', 1), ('缭', 1), ('缺', 1), ('秦', 1), ('播', 1), ('兆', 1), ('汉', 1), ('襄', 1), ('突', 1), ('随', 1), ('騧', 1), ('嘉', 1), ('泥', 1), ('谤', 1), ('洒', 1), ('扫', 1), ('应', 1), ('区', 1), ('诬', 1), ('卒', 1), ('散', 1), ('纣', 1), ('更', 1), ('坠', 1), ('常', 1), ('肩', 1), ('窥', 1), ('仞', 1), ('宜', 1), ('陵', 1), ('荣', 1), ('咨', 1), ('历', 1), ('允', 1), ('永', 1), ('牡', 1), ('赉', 1), ('审', 1), ('度', 1), ('虐', 1), ('纳', 1)]
《论语》是四书之一,充满着儒家智慧与人性的光辉,我们中国人的言行恐怕都与它有关。这里换个视角学习它,感谢你的阅读,希望你喜欢!
标签: #python怎么统计文本中的字频 #python统计字符串中某个字符出现的次数 #字符串中出现的次数python