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. Ionic01 简单介绍、环境搭建、创建项目、项目结构、创建组件、创建页面、子页面跳转

    1 Ionic 基本介绍 Ionic 是一款基于 Angular.Cordova 的强大的 HTML5 移动应用开发框架 , 可以快速创建一个跨平台的移动应用.可以快速开发移动 App.移动端 WEB ...

  2. Python3.7安装PyQt5的方法

    一.系统环境 操作系统:Win7 64位 Python Version:3.7 二.安装参考 方法1:pip install PyQt5 方法2:下载whl安装包安装 a.下载网址:https://p ...

  3. solr第二天 京东案例

    一.案例 电商网站的搜索 在互联网项目中做搜索都应该使用全文检索. 查询的是索引库,搜索功能跟数据库没有关系.实现分析: 1.先创建索引库 需要把数据库中的数据导入到索引库中. 需要把数据库中每个字段 ...

  4. ROS naviagtion analysis: costmap_2d--CostmapLayer

    博客转自:https://blog.csdn.net/u013158492/article/details/50493220 这个类是为ObstacleLayer StaticLayer voxelL ...

  5. Free GIS Software

    Refer to There are lots of free gis software listed in the website: http://www.freegis.org/ http://w ...

  6. Java多线程共享变量控制

    1. 可见性 如果一个线程对共享变量值的修改,能够及时的被其他线程看到,叫做共享变量的可见性.如果一个变量同时在多个线程的工作内存中存在副本,那么这个变量就叫共享变量 2. JMM(java内存模型) ...

  7. Paper: ImageNet Classification with Deep Convolutional Neural Network

    本文介绍了Alex net 在imageNet Classification 中的惊人表现,获得了ImagaNet LSVRC2012第一的好成绩,开启了卷积神经网络在cv领域的广泛应用. 1.数据集 ...

  8. Js杂谈-单体模式

    单体模式的思想:保证一个特定类仅有一个实例,意味着第二次使用同一个类创建新对象的时候,应该得到与第一次所创建对象完全相同的对象. 下面举几个实现的例子 1.new操作符 这种思想在于当使用同一个构造函 ...

  9. 关于使用idea的一些小技巧

    1:idea与git同步以后查看修改变化: file --setting--versioncontorller

  10. ecliplse的下载安装

    ecliplse的官方下载地址是: https://www.eclipse.org/downloads/packages/ 进去的速度可能比较慢,请耐心等待,进去之后的页面如下,为了便于理解下面的是我 ...