Last active
July 6, 2019 11:24
-
-
Save XChrisUnknownX/78ba099871c9062c254e04d8a5d2673d to your computer and use it in GitHub Desktop.
This program marks .txt transcripts for timed dictation/reading/practice. Must have Python 3 to use. Must keep in the same folder as the .txt you wish to mark.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import sys | |
import random | |
version = "1.1" | |
versiondescription = "I fixed the thing so it stops counting Q. and A. as a word." | |
print("Note: Timings are not exact. Transcript is marked at the 15 second reading interval.") | |
textname = input("Name of text file you wish to open. ") | |
wordspermin = input("Mark X words per minute. Input X. ") | |
symbol = input("Input marking symbol. ") | |
try: | |
wordsperminint = int(wordspermin) | |
wordspersecond = (wordsperminint/60) | |
roundedwordspersecond = round(wordspersecond) | |
roundedwordspersecondint = int(roundedwordspersecond) | |
if roundedwordspersecondint <= 0: | |
roundedwordspersecondint = 1 | |
else: | |
pass | |
wordsper15seconds = roundedwordspersecondint*15 | |
wordsper15seconds = int(round(wordsperminint/4)) | |
if wordsper15seconds <= 0: | |
wordsper15seconds = 1 | |
else: | |
pass | |
except: | |
input("Words per minute must be a number. Program will now terminate.") | |
sys.exit() | |
# Thanks to kyber I was able to make better logic. | |
trigger = wordsper15seconds | |
with open(textname,"r") as markfile, open("MarkedTranscript.txt","x") as newfile3: | |
wordscount = 0 | |
for line in markfile: | |
words = line.split() | |
words_num = len(words) | |
new_line = "" | |
for idx, word in enumerate(words, start=1): | |
wordscount += 1 | |
if word == "Q.": | |
wordscount -= 1 | |
elif word == "A.": | |
wordscount -= 1 | |
elif word == "COURT:": | |
wordscount -= 1 | |
elif word == "WITNESS:": | |
wordscount -= 1 | |
if wordscount == trigger: | |
new_line += symbol | |
wordscount = 0 | |
new_line += word + (" " if idx < words_num else "") | |
newfile3.write(new_line + '\n') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import sys | |
import random | |
version = "1" | |
print("Note: Timings are not exact. Transcript is marked at the 15 second reading interval.") | |
textname = input("Name of text file you wish to open. ") | |
wordspermin = input("Mark X words per minute. Input X. ") | |
symbol = input("Input marking symbol. ") | |
try: | |
wordsperminint = int(wordspermin) | |
wordspersecond = (wordsperminint/60) | |
roundedwordspersecond = round(wordspersecond) | |
roundedwordspersecondint = int(roundedwordspersecond) | |
if roundedwordspersecondint <= 0: | |
roundedwordspersecondint = 1 | |
else: | |
pass | |
wordsper15seconds = roundedwordspersecondint*15 | |
wordsper15seconds = int(round(wordsperminint/4)) | |
if wordsper15seconds <= 0: | |
wordsper15seconds = 1 | |
else: | |
pass | |
except: | |
input("Words per minute must be a number. Program will now terminate.") | |
sys.exit() | |
# Thanks to kyber I was able to make better logic. | |
trigger = wordsper15seconds | |
with open(textname,"r") as markfile, open("MarkedTranscript.txt","x") as newfile3: | |
wordscount = 0 | |
for line in markfile: | |
words = line.split() | |
words_num = len(words) | |
new_line = "" | |
for idx, word in enumerate(words, start=1): | |
wordscount += 1 | |
if wordscount == trigger: | |
new_line += symbol | |
wordscount = 0 | |
new_line += word + (" " if idx < words_num else "") | |
newfile3.write(new_line + '\n') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment