Browse Source

Add option for specifying random number generator seed

master
Blink The Things 4 years ago
parent
commit
62571d42d5
1 changed files with 5 additions and 3 deletions
  1. +5
    -3
      markov.py

+ 5
- 3
markov.py View File

@ -22,13 +22,15 @@ import os
import spacy
parser = argparse.ArgumentParser(description='Generate a novel using Markov chains.')
parser.add_argument('word_file', help='File used for word selection')
parser.add_argument('pos_file', help='File used to build part-of-speech Markov chain')
parser.add_argument('word_file', help='file used for word selection')
parser.add_argument('pos_file', help='file used to build part-of-speech Markov chain')
parser.add_argument('-s', '--seed', type=int, help='seed for random number generator')
args = parser.parse_args()
nlp = spacy.load('en_core_web_sm')
seed = 12345
seed = args.seed or 12345
rng = np.random.default_rng(seed)
words_text = ''


Loading…
Cancel
Save