()
| 78 | print("These sets will be ignored in some output files", ignoredSet) |
| 79 | |
| 80 | def initializeOracleText(): |
| 81 | print("Initializing Oracle text") |
| 82 | oracleDict = None |
| 83 | if not os.path.exists(allJson): |
| 84 | print("Need to download Json file...") |
| 85 | r = requests.get(allJsonUrl) |
| 86 | with open(allJson, 'w') as f: |
| 87 | f.write(r.text.encode("utf-8")) |
| 88 | |
| 89 | oracleDict = r.json() |
| 90 | |
| 91 | else: |
| 92 | with open(allJson) as f: |
| 93 | oracleDict = json.loads(f.read()) |
| 94 | |
| 95 | |
| 96 | aes = [k for k in oracleDict.keys() if u'\xc6' in k or u'\xf6' in k] |
| 97 | print("Normalizing %s names" % len(aes)) |
| 98 | for ae in aes: |
| 99 | data = oracleDict.pop(ae) |
| 100 | oracleDict[normalizeOracle(ae)] = data |
| 101 | |
| 102 | print("Found Oracle text for ", len(oracleDict)) |
| 103 | return oracleDict |
| 104 | |
| 105 | def normalizeOracle(oracle): |
| 106 | return oracle.replace(u'\u2014', '-').replace(u'\u2212', '-').replace(u'\u2018', "'").replace(u'\u201c', '"').replace(u'\u201d', '"').replace(u'\u2022', '-').replace(u'\xc6', 'AE').replace(u'\xf6', 'o').replace(u'\xb2', '^2').replace(u'\xae', '(R)').replace(u'\u221e', 'INF') |
no test coverage detected