Intelligent Poetry

Posted bingoyes

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Intelligent Poetry相关的知识,希望对你有一定的参考价值。

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,
	Please input the Number of Words:
	))
34 print()
35 Creat_Poem(number)
Intelligent Poetry

 

以上是关于Intelligent Poetry的主要内容,如果未能解决你的问题,请参考以下文章

hdu-4287 Intelligent IME

background intelligent transfer service怎么关闭

LightOJ1035 Intelligent Factorial Factorization(算数基本定理)

Python包管理之poetry的使用

background intelligent transfer service 关闭这项服务有啥弊端?

WIN7服务里的background intelligent transfer service启动不了