<commit_before><commit_msg>Added csv to json converter for Planes<commit_after>import json
import re



if __name__ == '__main__':
    print "Start"


    PATTERN = re.compile(r'''((?:[^,"']|"[^"]*"|'[^']*')+)''')

    fin = open("planes00001")
    fout = open("planes00001.json", "w")

    for line in fin:
        
        #print line
        #field = line.strip().split(",")
	field = PATTERN.split(line.strip())[1::2]
	#print field

        row = {}

        row['id'] = int(field[0])
        row['ts'] = long(field[1])
        row['speed'] = float(field[2])
        row['dist'] = float(field[3])
        row['bearing'] = float(field[4])
        row['rtid'] = int(field[5])
        row['orig'] = field[6]
        row['dest'] = field[7]
        row['secsToDep'] = int(field[8])
        row['lon'] = float(field[9])
        row['lat'] = float(field[10])

                
        jsonStr = json.dumps(row)

        #print jsonStr
        fout.write(jsonStr + "\n")

    fin.close()
    fout.close()


        
{'fraction_non_alphanumeric': 0.20495049504950494, 'fraction_numerical': 0.023762376237623763, 'mean_word_length': 2.2403846153846154, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6063174', 'n_tokens_mistral': 378, 'n_tokens_neox': 345, 'n_words': 65}