From 17e77c63720aaec6a1c08d1b27b55495cd18224b Mon Sep 17 00:00:00 2001 From: deadvey Date: Sun, 29 Mar 2026 20:54:25 +0100 Subject: [PATCH] Removed the old get_dictation file and updated the text outputing of the dictations --- dictate.py | 11 +++++++++-- get_dictation.py | 38 -------------------------------------- 2 files changed, 9 insertions(+), 40 deletions(-) delete mode 100644 get_dictation.py diff --git a/dictate.py b/dictate.py index 2896fed..8aa776e 100644 --- a/dictate.py +++ b/dictate.py @@ -13,10 +13,12 @@ def words(config): dump = json.load(file) words_list = dump['words'] dictation = [] + if not 'mode_modifier' in config: + config['mode_modifier'] = 20 for i in range(0, config['mode_modifier']): word = words_list[maths.biased_random(len(words_list)-1)] dictation.append(word) - print(word,end=' ') + print(word) for word in dictation: engine.say(word) engine.runAndWait() @@ -28,6 +30,8 @@ def timed(config): with open(f'languages/{config['language']}.json', 'r') as file: dump = json.load(file) words_list = dump['words'] + if not 'mode_modifier' in config: + config['mode_modifier'] = 30 # For keeping track of time start = time.time() while 1==1: @@ -63,9 +67,12 @@ def file(config): engine = pyttsx3.init() with open(f'{config['mode_modifier']}', 'r') as file: lines = file.readlines() + # Text output + for line in lines: + print(line) + # Dictation loop for line in lines: for word in line.split(' '): - print(word,end=' ') engine.say(word) engine.runAndWait() time.sleep(1/(config['wpm']/60)) diff --git a/get_dictation.py b/get_dictation.py deleted file mode 100644 index 6a67541..0000000 --- a/get_dictation.py +++ /dev/null @@ -1,38 +0,0 @@ -import json -import maths -import random - -def words(config): - dictation = [] - words_list = [] - with open(f'languages/{config['language']}.json', 'r') as file: - dump = json.load(file) - words_list = dump['words'] - - for i in range(0,config['mode_modifier']): - x = maths.biased_random(len(words_list)-1) - dictation.append(words_list[x]) - return dictation - -def time(config): - dictation = [] - words_list = [] - with open(f'languages/{config['language']}.json', 'r') as file: - dump = json.load(file) - words_list = dump['words'] - - # TODO: Really, these should be generated on demand - for i in range(0,config['mode_modifier']*3): - x = maths.biased_random(len(words_list)-1) - dictation.append(words_list[x]) - return dictation - -def quote(config): - dictation = [] - with open(f'quotes/{config['language']}.json', 'r') as file: - quotes = json.load(file) - print(quotes) - x = random.randint(0,len(quotes)-1) - print(quotes[x]) - - return dictation