pere's picture
test
21fc87c
raw
history blame
No virus
823 Bytes
# Python script to check the data types in a JSONL file
import json
import argparse
def check_data_types(jsonl_file_path):
with open(jsonl_file_path, 'r') as f:
for i, line in enumerate(f):
data = json.loads(line)
if not isinstance(data.get('text', None), str):
print(f"Inconsistent data type at row {i+1}. 'text' is not a string.")
if not isinstance(data.get('language', None), str):
print(f"Inconsistent data type at row {i+1}. 'language' is not a string.")
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Check data types in a JSONL file.')
parser.add_argument('--jsonl_file_path', required=True, help='Path to the JSONL file.')
args = parser.parse_args()
check_data_types(args.jsonl_file_path)