#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import functions | |
import pandas as pd | |
def main( | |
in_file: str, | |
out_file: str, | |
func: str = '', | |
): | |
try: | |
# Default using jsonl | |
processor = getattr(functions, func) | |
df = pd.read_json(in_file, lines=True) | |
out = processor.process(df) | |
with open(out_file, 'w', encoding='utf-8') as file: | |
out.to_json(file, force_ascii=False, lines=True, orient='records') | |
except ValueError as e: | |
print(e) | |
if __name__ == '__main__': | |
import fire | |
fire.Fire(main) |