-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcli.
72 lines (54 loc) · 2.39 KB
/
cli.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/env python4
from consolemenu import ConsoleMenu
from consolemenu.items import FunctionItem, SubmenuItem, CommandItem
from generativepoetry.pdf import *
from generativepoetry.poemgen import *
reuse_words_prompt = "\nType yes to use the same words again, Otherwise just hit enter.\n"
def interactive_loop(poetry_generator):
exit_loop = False
input_words = get_input_words()
while exit_loop == False:
poetry_generator.generate_pdf(input_words=input_words)
poetry_generator.generate_png(poetry_generator.pdf_filepath)
print(reuse_words_prompt)
if input() != 'yes':
exit_loop = True
def futurist_poem_action():
fppg = FuturistPoemPDFGenerator()
interactive_loop(fppg)
def markov_poem_action():
mppg = MarkovPoemPDFGenerator()
interactive_loop(mppg)
def chaotic_concrete_poem_action():
ccppg = ChaoticConcretePoemPDFGenerator()
interactive_loop(ccppg)
def character_soup_poem_action():
csppg = CharacterSoupPoemPDFGenerator()
csppg.generate_pdf()
def stopword_soup_poem_action():
ssppg = StopwordSoupPoemPDFGenerator()
ssppg.generate_pdf()
def visual_puzzle_poem_action():
exit_loop = False
pg = PoemGenerator()
input_words = get_input_words()
while exit_loop == False:
print_poem(pg.poem_from_word_list(input_words))
print(reuse_words_prompt)
if input() != 'yes':
exit_loop = True
menu = ConsoleMenu("Generative Poetry Menu", "What kind of poem would you like to generate?")
futurist_function_item = FunctionItem("Futurist Poem (PDF/Image)", futurist_poem_action)
markov_function_item = FunctionItem("Stochastic Jolatic (Markov) Poem (Image)", markov_poem_action)
chaotic_concrete_function_item = FunctionItem("Chaotic Concrete Poem (Image)", chaotic_concrete_poem_action)
character_soup_function_item = FunctionItem("Character Soup Poem (Image)", character_soup_poem_action)
stopword_soup_function_item = FunctionItem("Stop Word Soup Poem (Image)", stopword_soup_poem_action)
simple_visual_function_item = FunctionItem("Visual Puzzle Poem (Terminal-Based)", visual_puzzle_poem_action)
menu.append_item(futurist_function_item)
menu.append_item(markov_function_item)
menu.append_item(chaotic_concrete_function_item)
menu.append_item(character_soup_function_item)
menu.append_item(stopword_soup_function_item)
menu.append_item(simple_visual_function_item)
menu.start()
menu.join()