import os, orjson import re cur_dir = os.path.dirname(os.path.abspath(__file__)) txt_dir = cur_dir + "/text" # read folder names in /txt categories = os.listdir(txt_dir) def parse_speech(text): # This pattern matches speaker tags and extracts ID and NAME attributes speaker_pattern = re.compile(r'' in line or '