• 文件方式实现完整的英文词频统计实例


    1.读入待分析的字符串

    2.分解提取单词 

    3.计数字典

    4.排除语法型词汇

    5.排序

    6.输出TOP(20)

    >>> fo=open('test.txt','w')
    >>> fo.write('''I'm a big big girl
      in a big big world
      It's not a big big thing if you leave me
      but I do do feel
      that I too too will miss you much
      miss you much...
      I can see the first leaf falling
      it's all yellow and nice
      It's so very cold outside
      like the way I'm feeling inside
      I'm a big big girl
      in a big big world
      It's not a big big thing if you leave me
      but I do do feel
      that I too too will miss you much
      miss you much...
      Outside it's now raining
      and tears are falling from my eyes
      why did it have to happen
      why did it all have to end
      I'm a big big girl
      in a big big world
      It's not a big big thing if you leave me
      but I do do feel
      that I too too will miss you much
      miss you much...
      I have your arms around me ooooh like fire
      but when I open my eyes
      you're gone...
      I'm a big big girl
      in a big big world
      It's not a big big thing if you leave me
      but I do do feel
      that I too too will miss you much
      miss you much...
      I'm a big big girl
      in a big big world
      It's not a big big thing if you leave me
      but I do feel I will miss you much
      miss you much...''')
    1107
    >>> fo.close()

     结果:

  • 相关阅读:
    vsprintf解析
    带grub的软盘镜像制作
    SunnyOS准备4
    SunnyOS准备3
    SunnyOS准备1
    汇编第七日
    汇编第六日
    解决k8s集群中mount volume失败的问题
    更新k8s集群的证书
    为k8s集群配置自定义告警
  • 原文地址:https://www.cnblogs.com/xiaojiaqi/p/7595164.html
Copyright © 2020-2023  润新知