Readme:

  Creat poems.

  1. import re
  2. import random
  3. from collections import Counter
  4.  
  5. def Creat_Poem(number):
  6. w=random.sample(poem,number)
  7. for i in range(number//4):
  8. print(w[i],end='')
  9. print(',',end='')
  10. for i in range(number//4,number//2):
  11. print(w[i],end='')
  12. print('。')
  13. for i in range(number//2,number//4*3):
  14. print(w[i],end='')
  15. print(',',end='')
  16. for i in range(number//4*3,number):
  17. print(w[i],end='')
  18. print('。')
  19. return
  20.  
  21. dic=[]
  22. data=open('tangshi.txt','r')
  23. for i in data.readlines():
  24. dic.append(i.strip().replace(':','').replace(',','').replace('。','').replace('?','').replace('!','').replace('[','').replace(']',''))
  25. word=''.join(dic)
  26. word_str=re.sub(r"(?<=\w)","",word)
  27. word_list= list(word_str)
  28. a= [i for i in word_list if not str(i).isdigit()]
  29. s =Counter(a).most_common(300)
  30. poem=[]
  31. for i in s:
  32. poem.append(i[0])
  33. number=int(input('Merciful Sir,\n\tPlease input the Number of Words:\n\t'))
  34. print()
  35. Creat_Poem(number)

Intelligent Poetry

Intelligent Poetry的更多相关文章

  1. HDU 4287 Intelligent IME(字典树数组版)

    Intelligent IME Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

  2. 读书笔记-Autonomous Intelligent Vehicles(一)

    Autonomous intelligent vehicles have to finish the basic procedures: perceiving and modeling environ ...

  3. CodeForces Gym 100500A A. Poetry Challenge DFS

    Problem A. Poetry Challenge Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/10 ...

  4. UVa 10361 Automatic Poetry

    Automatic Poetry Input: standard input Output: standard output Time Limit: 2 seconds Memory Limit: 3 ...

  5. HDU 4287 Intelligent IME hash

    Intelligent IME Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?p ...

  6. UVA10361 - Automatic Poetry

    “Oh God”, Lara Croft exclaims, “it’s one of these dumb riddles again!” In Tomb Raider XIV, Lara is, ...

  7. Bleed Brake Master Cylinder with Intelligent Tester IT2

    When the brake fluid level drops too low in the master cylinder reservoir, air bubbles can get caugh ...

  8. HDU 4287 Intelligent IME

    Intelligent IME Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

  9. hdu Intelligent IME

    算法:字典树 题意:手机9键拼音:2:abc  3:def 4:ghi 5:jkl 6:mno 7:pqrs 8:tuv 9:wxyz: 第一行读入一个T,代表测试组数: 之后输入两个整数n和m, 有 ...

随机推荐

  1. 在Build Path中包含其他工程

    ------------siwuxie095                                 在 TestBuildPath 的 Build Path 中包含 SupportProje ...

  2. pt-table-checksum、pt-table-sync核对主从库一致性

    一.下载并安装工具http://www.percona.com/downloads/percona-toolkit/目前最新的版本是percona-toolkit_2.2.12.tar.gz上传到服务 ...

  3. 10个强大的Javascript表单验证插件推荐

    创建一个JavaScript表单验证插件,可以说是一个繁琐的过程,涉及到初期设计.开发与测试等等环节.实际上一个优秀的程序员不仅是技术高手,也应该是善假于外物的.本文介绍了10个不错的JavaScri ...

  4. 数字图像处理实验(14):PROJECT 06-01,Web-Safe Colors 标签: 图像处理MATLAB 2017-05-27 20:45 116人阅读

    实验要求: Objective: To know what are Web-safe colors, how to generate the RGB components for a given jp ...

  5. Luogu 3350 [ZJOI2016]旅行者

    BZOJ 4456 听若干个大佬讲过$n$遍终于写掉了. 我把时限基本上跑满了2333…… 分治 + 最短路. 首先我们去分治这个矩形格子,找到一条长边把它对半切,对切开的边上的每一个点跑一遍最短路然 ...

  6. Monkey进行压力测试定位问题分析

    Monkey测试的log分析,我们可以通过几个关键词来判断测试是否通过.   分析log方法一(粗糙一点): 1)Monkey finished打开LOG,查看log的最下端,是否有类似以下字段:## ...

  7. Monkey测试异常信息解读

    查看包名 1.cmd 下面输入 adb locat > D:\test.txt 2.ctrl+c 停掉刚刚 1 运行的进程 3.打开test.txt文件--搜索  Displayed  对应的内 ...

  8. 编写高质量代码改善C#程序的157个建议——建议32:总是优先考虑泛型

    建议32:总是优先考虑泛型 泛型的优点是多方面的,无论泛型类还是泛型方法都同时具备可重用性.类型安全性和高效率等特性,这是非泛型和非泛型方法无法具备的. 以可重用性为例: class MyList { ...

  9. Android Service基本知识总结(一)

    一.简介 Service是Android系统的后台服务组件,适用于开发无界面.长时间运行的应用功能Service特点如下: 没有用户界面 不会轻易被Android系统终止 在系统资源恢复后Servic ...

  10. asp.net get图

    前段 <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat=& ...