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. YII 模型关联之 一对一

    需求,一个用户对应一个用户信息表,  这两者之间的关系就是一对一 //首先查找出一个用户出来 $user=Users::find()->'])->one(); //然后查询, 第一个参数是 ...

  2. (三)maven出错记录

    此处因为是自己做的所以文笔带过,简单描述下 1\首先是jsp页面报错,缺少必要的servletx依赖jar包,需要在pom中配置 <dependency><groupId>ja ...

  3. Tensorflow训练结果测试

    代码参考(https://blog.csdn.net/disiwei1012/article/details/79928679) import osimport sysimport randomimp ...

  4. 权限管理RBAC

    四张表: 1.module:id/name //模块 2.action:id /module_id/name //权限 3.user:id/name //用户表 4.group:id/user_id ...

  5. 关于Rest Framework中View、APIView与GenericAPIView的对比分析

    关于Rest Framework中View.APIView与GenericAPIView的对比分析  https://blog.csdn.net/odyssues_lee/article/detail ...

  6. js-day

    1.克莱托指数 公式 :体重(kg) / (身高(m) * 身高(m)) < 20 : 偏瘦 > 20 <25 : 正常 > 25 : 偏旁 步骤: 1.输入体重(weight ...

  7. Customizing Site-Wide Behavior for ASP.NET Web Pages (Razor) Sites

    Customizing Site-Wide Behavior for ASP.NET Web Pages (Razor) Sites By Tom FitzMacken|February 17, 20 ...

  8. CSS概念 - 可视化格式模型(二) 定位概述(普通流、绝对定位)

    2.定位概念 上一节熟悉了盒模型, 现在来看一下可视化格式模型和定位模型. 理解这两个模型的细微差异是非常重要的, 因为它们一起控制着如何在页面上布置每个元素 2.1 可视化格式模型 CSS有三种基本 ...

  9. IIS 6.0 发布网站使用教程

    原文地址:http://wenku.baidu.com/view/95d8b49851e79b89680226aa.html

  10. asp.net get图

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