<jupyter_start><jupyter_text>Let's Make PoetryThis is a Python notebook that you, a student in my Creative Coding class, may find a useful starting point for your poetry project. This notebook allows you to create cells with text, like the one I'm typing in now, and cells with code like the ones below.The next cell contains a code snippet that will allow you to upload any text file, the contents of which will be stored in a string variable called `text`.To try it out, save a copy of this notebook to your Google Drive and run the next cell.<jupyter_code>from google.colab import files
import random
import nltk
nltk.download('punkt')
nltk.download('averaged_perceptron_tagger')
from textblob import TextBlob
uploaded = files.upload()
for fn in uploaded.keys():
  text = uploaded[fn].decode()



lyrics = TextBlob(text)
#print(lyrics.words)
dict_alph =lyrics.word_counts 
 	
sorted(dict_alph.keys())



proper_Noun = []
verbs_Participle = []
nouns = []
Personal_Pronoun = [] 
Modal = []
Preposition = []
Adverb = []
adverb_Comparative = []
Adjective = []
adjective_Comparative = []
coordinating_Conjunction = []
Whadverb = []
Verb_Non3rd = []
Verb = []
possessive_Pronoun = []
to = []
Particle = []
verb_Past = []
Determiner = []

for  word,pos in lyrics.tags:
  #print (word,pos)
  if (pos == 'DT'):
    Determiner.append(word)
  if (pos == 'NNP'):
    proper_Noun.append(word)
  if (pos =='VB'):
    Verb.append(word)
  if (pos == 'VBD'):
    verb_Past.append(word)
  if (pos == 'VBG'):
    verbs_Participle.append(word)
  if (pos == 'VBP'):
    Verb_Non3rd.append(word)  
  if (pos == 'NN'):
    nouns.append(word)
  if (pos == 'PRP'):
    Personal_Pronoun.append(word)
  if (pos == 'PRP$'):
    possessive_Pronoun.append(word)
  if (pos == 'MD'):
    Modal.append(word)
  if (pos == 'IN'):
    Preposition.append(word) 
  if (pos == 'RB'):
    Adverb.append(word)
  if (pos == 'RBR'):
    adverb_Comparative .append(word)
  if (pos == 'JJ'):
    Adjective.append(word)
  if (pos == 'JJR'):
    adjective_Comparative.append(word)
  if (pos == 'CC'):
    coordinating_Conjunction.append(word)
  if (pos == 'WRB'):
    Whadverb.append(word)
  if (pos == 'TO'):
    to.append(word)
  if (pos == 'RP'):
    Particle.append(word)





#print("nouns :", len(nouns))
#print(nouns)
my_NNP = random.choice(proper_Noun)
my_NN = random.choice(nouns)
my_NN2 = random.choice(nouns)
my_VBG = random.choice(verbs_Participle)
my_VBG2 = random.choice(verbs_Participle)
my_PRP = random.choice(Personal_Pronoun)
my_MD = random.choice(Modal)
my_IN = random.choice(Preposition)
my_RB = random.choice(Adverb)
my_RBR = random.choice(adverb_Comparative)
my_JJ = random.choice(Adjective)
my_JJR = random.choice(adjective_Comparative)
my_CC = random.choice(coordinating_Conjunction)
my_WRB = random.choice(Whadverb)
my_VBP = random.choice(Verb_Non3rd)
my_VBP2 = random.choice(Verb_Non3rd)
my_VBP3 = random.choice(Verb_Non3rd)
my_VB = random.choice(Verb)
my_PRPS = random.choice(possessive_Pronoun)
my_PRP2 = random.choice(Personal_Pronoun)
my_PRP3 = random.choice(Personal_Pronoun)
my_TO = random.choice(to)
my_RP = random.choice(Particle)
my_VBD = random.choice(verb_Past)
my_DT = random.choice(Determiner)

  
#print(my_PRP, my_VBP, my_WRB, my_JJ, my_PRP2, my_VBP2, my_VBG, my_NN)
#print (my_PRP2, my_VBP2, my_PRP2, my_VB)
#print (my_PRP, my_VBP3, my_PRP3, my_IN, my_PRPS, my_NN, my_PRP2, my_VBP2, my_RB)
#print(my_WRB, my_PRP, my_VBP, my_TO, my_VB, my_RP,",", my_VB, my_RP)
#print (my_PRP, my_VBD, my_IN, my_NN)
#print (my_PRP3, my_VBD, my_IN, my_NNP)
#print (my_IN, my_NN)
#print (my_PRP, my_VBP, my_PRP2, my_RP)
#print (my_VBG, my_TO, my_VB, my_DT, my_NN)
#PRP VBP WRB JJ PRP VBP VBG NN
#PRP VBP PRP VB
#PRP VBP PRP IN PRP$ NN PRP VBP RB
#WRB PRP VBP TO VB RP VB RP
#PRP VBD IN NNP


print("\n")
print("",lyrics.sentences[random.randint(0, len(lyrics.sentences)-1)],"\n",my_PRP, my_VBP3, my_PRP3, my_IN, my_PRPS, my_NN, my_PRP2, my_VBP2, my_RB, "\n", lyrics.sentences[random.randint(0, len(lyrics.sentences)-1)],"\n",my_NNP, my_RB, my_VB, my_DT, my_NN2, my_RP)

print("\n")

print("",lyrics.sentences[random.randint(0, len(lyrics.sentences)-1)], "\n",my_JJ, my_NN, my_PRP, my_VBP, my_IN, my_PRP2)
print("",lyrics.sentences[random.randint(0, len(lyrics.sentences)-1)], "\n", my_WRB, my_PRP, my_VBP, my_TO, my_VB, my_RP,",", my_VB, my_RP)

print("\n")

print("",lyrics.sentences[random.randint(0, len(lyrics.sentences)-1)],"\n",my_PRP3, my_VBD, my_IN, my_NNP, "\n", lyrics.sentences[random.randint(0, len(lyrics.sentences)-1)],"\n",my_PRP, my_VBP, my_PRP2, my_RP)




listofTuples = sorted(dict_alph.items() ,  key=lambda x: x[1])
for elem in listofTuples :
    print(elem[0] , " ::" , elem[1] ) 
sentance = "Na na na Na na"
sentance = TextBlob(sentance)
for  word,pos in sentance.tags:
  print (word,pos)<jupyter_output>Na NNP
na TO
na VB
Na NNP
na NN
hello
gfgfh
{'fraction_non_alphanumeric': 0.1476897689768977, 'fraction_numerical': 0.009282178217821782, 'mean_word_length': 5.0236024844720495, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '328141', 'license': 'MIT', 'n_tokens_mistral': 2075, 'n_tokens_neox': 2007, 'n_words': 453, 'path': 'poem/PopPunk.ipynb', 'repo_name': 'Simsalab1m/creativecode', 'size': '4848'}