Last active
July 6, 2019 11:27
-
-
Save XChrisUnknownX/a09f3be9985216fe89bbf8e7f07d6473 to your computer and use it in GitHub Desktop.
This is a modified version of the transcript marker that takes r.txt and turns it into marked transcripts 20 WPM to 240 WPM at 10 WPM steps.
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 = "r.txt" | |
wordspermin = "0" | |
symbol = "//" | |
def calwords(wordspermin): | |
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() | |
return [wordsperminint,wordspersecond,roundedwordspersecond,roundedwordspersecondint,wordsper15seconds] | |
# Thanks to kyber I was able to make better logic. | |
wint = 10 | |
wordspermin = "0" | |
for q in range(0,23): | |
wint += 10 | |
wordspermin = str(wint) | |
rename = calwords(wordspermin) | |
wordsperminint = rename[0] | |
wordspersecond = rename[1] | |
roundedwordspersecond = rename [2] | |
roundedwordspersecondint = rename[3] | |
wordsper15seconds = rename[4] | |
trigger = wordsper15seconds | |
with open(textname,"r") as markfile, open("MarkedTranscript" + wordspermin + ".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 | |
else: | |
pass | |
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