File size: 823 Bytes
21fc87c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 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)