import json # Check if contains num def notNumStr(instr): for item in instr: if '\u0041' <= item <= '\u005a' or ('\u0061' <= item <='\u007a') or item.isdigit(): return False return True # Read Target Case if Json def readSingleTestCases(testFile): with open(testFile) as json_data: try: testData = json.load(json_data) except: # This try block deals with incorrect json format that has ' instead of " data = json_data.read().replace("'",'"') try: testData = json.loads(data) # This try block deals with empty transcript file except: return "" returnString = "" for item in testData: try: returnString += item['text'] except: returnString += item['statement'] return returnString