-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOrgFunction.py
More file actions
95 lines (72 loc) · 1.92 KB
/
OrgFunction.py
File metadata and controls
95 lines (72 loc) · 1.92 KB
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#Organization Generator by Mike Bradley
import sys
import os
import csv
import random
__location__ = os.path.dirname(os.path.abspath(sys.argv[0]))
f = open(os.path.join(__location__, 'data/Nouns.csv'),'rU')
reader = csv.reader(f)
nouns = []
for line in reader:
nouns.append(line)
f.close()
f = open(os.path.join(__location__, 'data/Causes.csv'),'rU')
reader = csv.reader(f)
causes = []
for line in reader:
causes.append(line)
f.close()
f = open(os.path.join(__location__, 'data/Stances.csv'),'rU')
reader = csv.reader(f)
stances = []
for line in reader:
stances.append(line)
f.close()
f = open(os.path.join(__location__, 'data/Firsts.csv'),'rU')
reader = csv.reader(f)
firsts = []
for line in reader:
firsts.append(line)
f.close()
total = 0
for item in nouns:
total += int(item[1])
item[1] = total
total = 0
for item in firsts:
total += int(item[1])
item[1] = total
total = 0
for item in stances:
total += int(item[1])
item[1] = total
total = 0
for item in causes:
total += int(item[1])
item[1] = total
def OrgFunc():
nounNum = random.randint(0,int(nouns[int(len(nouns))-1][1]))
causeNum = random.randint(0,int(causes[int(len(causes))-1][1]))
stanceNum = random.randint(0,int(stances[int(len(stances))-1][1]))
firstNum = random.randint(0,int(firsts[int(len(firsts))-1][1]))
noun = nouns[0][0]
for x in range(len(nouns)):
if int(nouns[x][1])<= nounNum:
noun = nouns[x][0]
cause = causes[0][0]
for x in range(len(causes)):
if int(causes[x][1])<= causeNum:
cause = causes[x][0]
stance = stances[0][0]
for x in range(len(stances)):
if int(stances[x][1])<= stanceNum:
stance = stances[x][0]
first = ""
if random.randint(0,1) == 1:
first = firsts[0][0]
for x in range(len(firsts)):
if int(firsts[x][1])<= firstNum:
first = firsts[x][0]
first += " "
reString = first + noun + " " + stance + " " + cause
return(reString)