(filepath)
| 55 | json.dump(obj, f, indent=indent) |
| 56 | |
| 57 | def read_jsonl(filepath): |
| 58 | data = [] |
| 59 | |
| 60 | with open(filepath) as f: |
| 61 | lines = f.readlines() |
| 62 | for line in lines: |
| 63 | data.append(json.loads(line)) |
| 64 | |
| 65 | return data |
| 66 | |
| 67 | def get_doc(text): |
| 68 | if text not in doc_cache: |