deleted: generatedStory<class 'datetime.date'>.txt

modified:   madlibs.py
	new file:   saved stories/generatedStory-17-07-2019-13:12:37.txt
	new file:   saved stories/generatedStory-17-07-2019-13:19:38.txt
	new file:   saved stories/generatedStory-Mom.txt
	modified:   test.py
This commit is contained in:
Caleb Fontenot 2019-07-17 13:25:58 -07:00 committed by Caleb Fontenot
parent 0f830805ea
commit 3fe9fd7304
5 changed files with 73 additions and 27 deletions

View File

@ -1,3 +0,0 @@
Once upon a time, there were three [[...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...]] pigs. One day, their mother said, "You are all grown up and must [[...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...]] on your own." So they left to [[...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...]] their houses. The first little pig wanted only to [[...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...]] all day and quickly built his house out of [[...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...]]. The second little pig wanted to [[...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...]] and [[...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...]] all day so he [[...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...]] his house with [[...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...]]. The third [[...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...]] pig knew the wolf lived nearby and worked hard to [[...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...]] his house out of [[...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...]]. One day, the wolf knocked on the first pig's [[...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...]]. "Let me in or I'll [[...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...]] your house down!" The pig didn't, so the wolf [[...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...]] down the [[...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...]]. The wolf knocked on the second pig's [[...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...]]. "Let me in or I'll blow your [[...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...]] down!" The pig didn't, so the wolf [[...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...]] down the house. Then the wolf knocked on the third [[...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...]] pig's door. "Let me in or I'll blow your house down!" The little pig didn't, so the wolf [[...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...]] and [[...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...]].He could not blow the house down. All the pigs went to live in the [[...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...]] house and they all [[...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...]] happily ever after.
Generated by Caleb Fontenot's madlibs.pyOnce upon a time, there were three [[...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...]] pigs. One day, their mother said, "You are all grown up and must [[...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...]] on your own." So they left to [[...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...]] their houses. The first little pig wanted only to [[...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...]] all day and quickly built his house out of [[...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...]]. The second little pig wanted to [[...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...]] and [[...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...]] all day so he [[...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...]] his house with [[...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...]]. The third [[...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...]] pig knew the wolf lived nearby and worked hard to [[...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...]] his house out of [[...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...]]. One day, the wolf knocked on the first pig's [[...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...]]. "Let me in or I'll [[...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...]] your house down!" The pig didn't, so the wolf [[...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...]] down the [[...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...]]. The wolf knocked on the second pig's [[...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...]]. "Let me in or I'll blow your [[...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...]] down!" The pig didn't, so the wolf [[...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...]] down the house. Then the wolf knocked on the third [[...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...]] pig's door. "Let me in or I'll blow your house down!" The little pig didn't, so the wolf [[...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...]] and [[...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...]].He could not blow the house down. All the pigs went to live in the [[...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...]] house and they all [[...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...], [...]] happily ever after.
Generated by Caleb Fontenot's madlibs.py

View File

@ -2,12 +2,13 @@
debug = 1
# Import the libraries we will use
import datetime
from datetime import datetime
import re
import sys
import random
import platform
import argparse
import os
# check to see if termcolor is installed, we need it for color to work
try:
from termcolor import colored
@ -18,7 +19,6 @@ if debug == 1:
print("termcolor is installed!")
# If we are on Windows, we need to do a little more to get color to work
if platform.system() == 'Windows':
import os
os.system('color')
# ArgSparce
parser = argparse.ArgumentParser()
@ -91,29 +91,70 @@ if debug == 1:
replacedNumber = len(filtered)
# Run a loop to get the words
#This normally is just "replaceList = []"
replaceList = ['1', '2', '43', '', '2643', '62', '36', '236', '23', '6234', '623', '623', '46', '2346', '234', '6234', '623', '4', '234', '6234', '2346', '2345124', '12', '1']
#for loopCount in range(replacedNumber):
# replaceVar = input("Give me a(n) "+filtered[loopCount]+": ")
# replaceList.append(replaceVar)
replaceList = []
#replaceList =['', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24']
replaceList.append("")
print("Type a noun, verb, adjective, or adverb depending on what it asks you, followed by enter.", '\n')
for loopCount in range(replacedNumber):
replaceVar = input("Give me a(n) "+colored(filtered[loopCount], 'blue')+": ")
replaceList.append(replaceVar)
print(replaceList)
# Run a loop to replace the words
print("Replacing Words...")
for loopCount in range(replacedNumber):
currentReplace = replaceList[loopCount]
print(re.finditer(r'<.*?>',storyContent))
print("Replacing", currentReplace)
filteredReplaced = re.sub(r'<.*?>',currentReplace, storyContent, loopCount)
print(filteredReplaced)
#This exit was intensional, just to prevent it from executing the rest of the program while I work on it...
exit()
currentDate1 = datetime.date
currentDate2 = str(currentDate1)
# Split the Story Content into a list
storyContentList = re.split(r'<.*?>', storyContent)
# Count the items in the list
storyContentCount = len(storyContentList)
x = 0
for loopCount in range(storyContentCount):
#print(storyContentList[loopCount])
storyContentList.insert(x, replaceList[loopCount])
x = x+2
# To get colored words for our output, we need to add the appropiate commands to our variable.
storyContentListColored = re.split(r'<.*?>', storyContent)
x = 0
#for loopCount in range(storyContentCount):
# #print(storyContentList[loopCount])
# storyContentListColored[x-1] = '\"'+re.escape(storyContentListColored[x-1])+'\"'
# storyContentListColored.insert(x, "colored(\'"+replaceList[loopCount]+"\', '"\'+blue+"\""),")
# x = x+2
#print(storyContentListColored)
#print('\n')
# Merge lists into a string
generatedStory = ""
generatedStory = generatedStory.join(storyContentList)
# for the colored printout...
#generatedStoryColored = ""
#generatedStoryColored = generatedStoryColored.join(storyContentListColored)
#print(generatedStoryColored)
print(generatedStory)
#print(exec(generatedStoryColored))
#exit()
#Alright! We're done! Let's save the story to a file
now = datetime.now()
if os.path.exists("saved stories"):
pass
else:
os.system("mkdir \"saved stories\"")
currentDate = now.strftime("%d-%m-%Y-%H:%M:%S")
saveFile = 'saved stories/generatedStory-'+currentDate+'.txt'
print("Saving story to .txt file")
f = open('generatedStory'+currentDate2+'.txt', 'a')
f.write(filteredReplaced)
f.seek(3)
f.write("Generated by Caleb Fontenot\'s madlibs.py")
f.close()
file = open(saveFile, 'w+')
line_offset = []
offset = 0
for line in file:
line_offset.append(offset)
offset += len(line)
file.seek(0)
file.write(filteredTitle[0]+'\n'+'\n')
file.write(generatedStory)
file.write('\n'+"Generated by Caleb Fontenot\'s madlibs.py")
file.close()

View File

@ -0,0 +1,5 @@
Three Little Pigs
Once upon a time, there were three crazy pigs. One day, their mother said, "You are all grown up and must blinking on your own." So they left to swims their houses. The first little pig wanted only to skydives all day and quickly built his house out of pomegranite. The second little pig wanted to hop and throw all day so he vomited his house with tigers. The third light pig knew the wolf lived nearby and worked hard to pluummet his house out of dogs. One day, the wolf knocked on the first pig's possum. "Let me in or I'll retrieve your house down!" The pig didn't, so the wolf tackled down the speaker. The wolf knocked on the second pig's tree. "Let me in or I'll blow your starship down!" The pig didn't, so the wolf teletransported down the house. Then the wolf knocked on the third mediocre pig's door. "Let me in or I'll blow your house down!" The little pig didn't, so the wolf licked and pooped.He could not blow the house down. All the pigs went to live in the foot house and they all sqeegeed happily ever after.
Generated by Caleb Fontenot's madlibs.py

View File

@ -0,0 +1,3 @@
Once upon a time, there were three pretty pigs. One day, their mother said, "You are all grown up and must ran on your own." So they left to liked their houses. The first little pig wanted only to festered all day and quickly built his house out of girls. The second little pig wanted to tossed and acted all day so he swam his house with boys. The third funky pig knew the wolf lived nearby and worked hard to made his house out of dogs. One day, the wolf knocked on the first pig's cat. "Let me in or I'll eat your house down!" The pig didn't, so the wolf ate down the candle. The wolf knocked on the second pig's chair. "Let me in or I'll blow your book down!" The pig didn't, so the wolf read down the house. Then the wolf knocked on the third smelly pig's door. "Let me in or I'll blow your house down!" The little pig didn't, so the wolf sat and saw.He could not blow the house down. All the pigs went to live in the chair house and they all looked happily ever after.
Generated by Caleb Fontenot's madlibs.py

View File

@ -15,7 +15,7 @@ time.sleep(1)
# prints phrase letters
for number in range(amount):
print(number, phrase[number])
print(number, phrase[number], end='\r')
time.sleep(0.1)
# prints phrase letters in random order
@ -24,5 +24,5 @@ print("Now, in random order!")
time.sleep(1)
for number in range(amount):
exec('iteration = random.randint(0,amount - 1)')
print(number, phrase[iteration], '\n' "iteration", iteration)
print(number, phrase[iteration], "iteration", iteration, end='\r')
time.sleep(0.1)