Readme:

  Creat poems.

 import re
import random
from collections import Counter def Creat_Poem(number):
w=random.sample(poem,number)
for i in range(number//4):
print(w[i],end='')
print(',',end='')
for i in range(number//4,number//2):
print(w[i],end='')
print('。')
for i in range(number//2,number//4*3):
print(w[i],end='')
print(',',end='')
for i in range(number//4*3,number):
print(w[i],end='')
print('。')
return dic=[]
data=open('tangshi.txt','r')
for i in data.readlines():
dic.append(i.strip().replace(':','').replace(',','').replace('。','').replace('?','').replace('!','').replace('[','').replace(']',''))
word=''.join(dic)
word_str=re.sub(r"(?<=\w)","",word)
word_list= list(word_str)
a= [i for i in word_list if not str(i).isdigit()]
s =Counter(a).most_common(300)
poem=[]
for i in s:
poem.append(i[0])
number=int(input('Merciful Sir,\n\tPlease input the Number of Words:\n\t'))
print()
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. Quick Find

    --------------------siwuxie095                                 Quick Find         这里介绍并查集的一种实现思路:Qui ...

  2. JavaScript(JS)实现省市联动选择下拉列表

    在开发一个应用的时候需要用刀省市联动的下拉列表,网上找到不少.但是要么太复杂,难以修改:要么根本就用不了,最后自己在一个示例中提取出数据,然后自己写了一个,简单易懂,适合新手... 代码如下: Pro ...

  3. Entity Framework 6.0 Tutorials(8):Custom Code-First Conventions

    Custom Code-First Conventions: Code-First has a set of default behaviors for the models that are ref ...

  4. Maven——继承和聚合

    实际项目中,可能正要构建一个大型的系统,但又不想一遍又一遍的重复同样的依赖元素,这种情况是经常出现的.不过还好,maven提供了继承机制,项目可以通过parent元素使用继承,可以避免这种重复.当一个 ...

  5. jQuery提供的存储接口

    jQuery.data( element, key, value ) //静态接口,存数据jQuery.data( element, key ) //静态接口,取数据 .data( key, valu ...

  6. Android Canvas的save(),saveLayer()和restore()浅谈

    save()  saveLayer()  restore() 1.在自定义控件当中你onMeasure和onLayout的工作做完成以后就该绘制该控件了,有时候需要自己在控件上添加一些修饰来满足需求 ...

  7. kali linux之防火墙识别

    通过检查回包,可能识别端口是否经过防火墙过滤,设备多种多样,结果存在一定的误差 Send Response   Type SYN   NO    Filtered(先发送syn 如果不给回复 防火墙可 ...

  8. 使用python-docx生成Word文档

    首先是安装python-docx:(centos环境) pip install python-docx 基本方法使用: from docx import Document from docx.shar ...

  9. 【bzoj3309】DZY Loves Math 莫比乌斯反演+线性筛

    Description 对于正整数n,定义f(n)为n所含质因子的最大幂指数.例如f(1960)=f(2^3 * 5^1 * 7^2)=3, f(10007)=1, f(1)=0. 给定正整数a,b, ...

  10. ORA-03113 : end-of-file on communication channel

    现象一: 数据库startup时,出现数据库无法正常mount,并报ORA-03113错误. SQL> startup ORACLE instance started. Total System ...