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. mybatis内部类映射写法

    直接上代码:   mybatis内部类映射使用$而不是.

  2. 661. Image Smoother色阶中和器

    [抄题]: Given a 2D integer matrix M representing the gray scale of an image, you need to design a smoo ...

  3. Centos里没有lsb_release

    查看Centos操作系统版本,输入指令 lsb_release -a 报无此命令 解决办法,安装lsb_release 1.执行指令:yum install -y redhat-lsb 2.安装完毕后 ...

  4. Spring 实例化bean的三种方式

    第一种方法:直接配置Bean <bena id="所需要实例化的一个实例名称" class="包名.类名"/> 例如: 配置文件中的bean.XML ...

  5. Vue 与Angular、React框架的对比

    首先,我们先了解什么是MVX框架模式? MVX框架模式:MVC+MVP+MVVM 1.MVC:Model(模型)+View(视图)+controller(控制器),主要是基于分层的目的,让彼此的职责分 ...

  6. 验证码测试-demo

    <!DOCTYPE html><html><head><meta charset="UTF-8"><title>Inse ...

  7. Java 并行和并发

    并行:指两个或多个事件在同一时刻点进行. 并发:指两个或多个事件在同一时间段进行.

  8. Android自动提示控件:AutoCompleteTextView和MultiAutoCompleteTextView

    在输入框中输入我们想要输入的信息就会出现其他与其相关的提示信息,这种效果在Android中是用AutoCompleteTextView实现的. 一.AutoCompleteTextView:单一匹配 ...

  9. WebApi跨域问题解决

    因为第一次用webapi,并且还是前后台分离,所以设置到了跨域,在百度上找了很多解决办法,但是基本都存在缺陷,我这里分享一下我自己的经验 1.首先配置Web.config 这样配置发布到服务器就可以跨 ...

  10. 七月小说网 Python + GraphQL (三)

    概述 后台数据库几个基本表基本搭建完毕,看了下Github Develop的V4 Api抛弃了RESTful,采用GraphQL,感觉很有意思,一看文档,竟然有Python的开源实现 Graphene ...