Skip to content

Commit

Permalink
cmd params for #repeats and #generated sentences
Browse files Browse the repository at this point in the history
  • Loading branch information
breznak committed Nov 16, 2013
1 parent cdc547d commit 2719cdd
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions client/linguist.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
PRINT_EVERY_REPEAT_N = 1

TERMINATORS = ['.','!','?','|']
NUM_SENTENSES = 5 # number for story sentenses generated
NUM_SENTENCES = 5 # number for story sentences generated
STORY_START = "The dog"
_QUIT = "QUIT"

Expand Down Expand Up @@ -126,19 +126,26 @@ def tellStory(model, startSent, lenght):

if c in TERMINATORS:
numSent += 1

print(' \n')


if __name__ == "__main__":
if len(sys.argv) > 1:
datapath = sys.argv[1]
if len(sys.argv) > 2:
NUM_REPEATS = int(sys.argv[2])
if len(sys.argv) > 3:
NUM_SENTENCES = int(sys.argv[3])

model = runLinguist(datapath)
print('==========================================')
print('Welcome young adventurer, let me tell you a story! ')
while True:
STORY_START = raw_input('Enter story start (QUIT to go to work): ')
if(STORY_START == "QUIT"):
break
tellStory(model, STORY_START, NUM_SENTENSES)
tellStory(model, STORY_START, NUM_SENTENCES)

print('Farewell')
else:
print "Usage: python linguist.py [path/to/data.txt]"
print "Usage: python linguist.py path/to/data.txt [num_repeats [num_sentences]]"

0 comments on commit 2719cdd

Please sign in to comment.