<commit_before>#!/usr/bin/env python
'''The script parses values from data downloaded from APD website.

Please refer to the cookbook for how to download data automatically.

'''

import sys
import re
import csv
import glob

def main():
    for infile in glob.glob('*.txt'):
        html = open(infile).read()

        # use regular expression to parse all values
        aa_compositions = re.findall('[A-Z]:\s(\d+)\s,', html)
        other_values = re.findall('=\s+([-+]?[\s+]?[0-9]*\.?[0-9]+)', html)

        # write values in CSV format
        writer = csv.writer(sys.stdout, 'excel-tab')
        other_values[-6] = int(other_values[-6])  # total charge
        writer.writerows([aa_compositions + other_values])

if __name__=='__main__':
    main()

<commit_msg>removed a molecular weight from the output CSV.<commit_after>#!/usr/bin/env python
'''The script parses values from data downloaded from APD website.

Please refer to the cookbook for how to download data automatically.

'''

import sys
import re
import csv
import glob

def main():
    for infile in glob.glob('*.txt'):
        html = open(infile).read()

        # use regular expression to parse all values
        aa_compositions = re.findall('[A-Z]:\s(\d+)\s,', html)
        other_values = re.findall('=\s+([-+]?[\s+]?[0-9]*\.?[0-9]+)', html)
        bohman = re.findall('is:\s([-+]?[\s+]?[0-9]*\.?[0-9]+)', html)

        # write values in CSV format
        writer = csv.writer(sys.stdout, 'excel-tab')
        other_values[-6] = int(other_values[-6])  # total charge
        writer.writerows([aa_compositions + other_values[:-3] +
                                        other_values[-2:] + bohman])

if __name__=='__main__':
    main()


{'fraction_non_alphanumeric': 0.16268221574344024, 'fraction_numerical': 0.010495626822157435, 'mean_word_length': 2.821826280623608, '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': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5408063', 'n_tokens_mistral': 586, 'n_tokens_neox': 561, 'n_words': 150}