-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSentence_Generator_Module.py
80 lines (59 loc) · 2.53 KB
/
Sentence_Generator_Module.py
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
73
74
75
76
77
78
79
80
# Uses Noam Chomsky Syntactic Structures
# NP + VP
# (T + N) + (V + P)
import random as ran
import sys
#import VisionAPI_Module
# the above import is currently bricked on my device, the json token will have to be updated.
# print(T, N)
def assemble(*args):
return " ".join(args)
def NP(T, N):
return assemble(T, N)
def VP(Verb, NP):
return assemble(Verb, NP)
def sentence(NP, Adverb1, VP1):
return assemble(NP, Adverb1, VP1+".")
# now i must make several different lists related to the different moods
def loop(X, mood):
T_1 = ['The', 'Their', 'Our', 'His', 'Her', 'That', 'This', 'Your'] # cap
T_2 = ['the', 'their', 'our', 'his', 'her',
'that', 'this', 'your'] # no cap
N = ['man', 'gentleman', 'person', 'woman',
'girl', 'boy', 'lady', 'child', 'individual']
Verb = ['hit', 'polished', 'healed', 'tore', 'treated', 'coded', 'ran']
# angry, joy, sorrow, surprised
# Must put different conditional statements.
angry_adverb = ['furiously', 'bitterly', 'terribly',
'violently', 'intensely', 'savagely']
joy_adverb = ['joyfully', 'happily',
'cheerfully', 'merrily', 'ecstatically', 'gleefully', 'contentedly']
sorrow_adverb = ['sadly', 'sorrowfully',
'dejectedly', 'gloomily', 'joylessly']
surprised_adverb = ['suddenly', 'shockingly', 'surprisingly']
for i in range(X):
N1, N2 = ran.choice(N), ran.choice(N)
T1, T2 = ran.choice(T_1), ran.choice(T_2)
# need to make conditional statements dependent upon mood
# if mood is happy, angry, sorrowful, adverb will be different
Verb1 = ran.choice(Verb)
if mood == 'Joy':
Adverb1 = ran.choice(joy_adverb)
elif mood == 'Angry':
Adverb1 = ran.choice(angry_adverb)
elif mood == 'Sorrow':
Adverb1 = ran.choice(sorrow_adverb)
elif mood == 'Surprised':
Adverb1 = ran.choice(surprised_adverb)
NP1 = NP(T1, N1)
NP2 = NP(T2, N2)
VP1 = VP(Verb1, NP2)
print(sentence(NP1, Adverb1, VP1))
def main():
# So what I'm thinking is the user will decide how many sentences they want to generate.
# We will have to get this information from the server, refer to Kai's resource for information
X = (int)(sys.argv[2])
mood = sys.argv[1]
# this will call the module, and then ask for the mod
result = loop(X, mood) # generates X amount of sentence
main()