This commit is contained in:
2018-10-12 18:49:54 -04:00
commit e47f7a04e8
8 changed files with 80 additions and 0 deletions

27
models.py Normal file
View File

@@ -0,0 +1,27 @@
import json
import os
from converters import converters
class TranscriptConverter:
def __init__(self, path, format_name):
self.path = path
with open(path, 'r') as fin:
self.words = converters[format_name](json.load(fin))
# wordStart
# wordEnd
# word
# confidence
# index
# space
# alwaysCapitalized
def to_json(self):
return json.dumps(self.words, indent=4)
def save(self):
name = f"{os.path.basename(self.path).split('.json')[0]}_processed.json"
with open(name, 'w') as fout:
fout.write(self.to_json())