-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
31 lines (25 loc) · 791 Bytes
/
test.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
import time
import sys
import os
from markov import Markov
start_time = time.time()
if len(sys.argv) > 1:
seed = list(sys.argv[1:-2])
depth = int(sys.argv[-2])
iterations = int(sys.argv[-1])
else:
seed = ['but', 'with', 'except', 'for', ':', 'app', 'band']
depth = 4
iterations = 1
dir = os.path.dirname(__file__)
filename = os.path.join(dir,
'facebook-page-post-scraper',
'1500321840185061_facebook_statuses.csv'
)
markov = Markov(filename, seed=seed, depth=depth)
for i in range(iterations):
line = markov.generate_markov_text()
while len(line) > 140:
line = markov.generate_markov_text()
print("\n" + line)
print("\n--- %s seconds ---" % (time.time() - start_time))