zoukankan      html  css  js  c++  java
  • 综合练习

    1. 词频统计预处理
    2. 下载一首英文的歌词或文章
    3. 将所有,.?!’:等分隔符全部替换为空格
    4. 将所有大写转换为小写
    5. 生成单词列表
    6. 生成词频统计
    7. 排序
    8. 排除语法型词汇,代词、冠词、连词
    9. 输出词频最大TOP10
    10.  text="No matter how many characters are available for your password you should be sure to use every one of them. The more characters available for your password and the more you use makes it that much harder to figure out the combination. Always make use of all characters available for a strong and secure password.Personal information such as names, birthdays, nicknames, pet's names, social security numbers, and the like should never, ever, ever be used because these are way too obvious and too easy to crack. The more you avoid using things like this as your passwords, the more secure your login areas will be."
      sym=[',','.','!','?','’',':','$','%']
      word= ['a','in','of','the','to','at','it','on','and','so','his','that',
              'not','was','my','were','we','he','an','as','is','for','mr','us']
      new_text=text
      for i in range(len(sym)):
      	new_text=new_text.replace(sym[i],'')
      new_text=new_text.lower()
      text_list=new_text.split()
      d=dict(zip())
      for i in text_list:
      	d[i]=new_text.count(i)
      
      	
      for i in word:
      	if(d.get(i)!=None):
      		d.pop(i)
      
      
      new_d=sorted(d.items(),key=lambda x:x[1],reverse=True)
      for i in range(10):
      	print(new_d[i])
      

  • 相关阅读:
    高中时的口头禅
    我想跟你说
    jQuery火箭图标返回顶部代码
    jQuery火箭图标返回顶部代码
    jQuery火箭图标返回顶部代码
    jQuery火箭图标返回顶部代码
    jQuery火箭图标返回顶部代码
    jQuery火箭图标返回顶部代码
    jQuery火箭图标返回顶部代码
    jQuery火箭图标返回顶部代码
  • 原文地址:https://www.cnblogs.com/shadows24/p/8646043.html
Copyright © 2011-2022 走看看