zoukankan      html  css  js  c++  java
  • 文件方式实现完整的英文词频统计实例

    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()

     结果:

  • 相关阅读:
    14、流程分析法
    13、场景法
    SPL之Iterator(迭代器)接口
    MySQL的自动补全和语法高亮工具MyCli
    如何在mmseg3添加词库
    sphinx 配置文件全解析
    配置samba 服务器 共享Linux目录
    Centos7 下coreseek的安装
    机器学习常用的降维方法
    mysql 分类
  • 原文地址:https://www.cnblogs.com/xiaojiaqi/p/7595164.html
Copyright © 2011-2022 走看看