<commit_before><commit_msg>Performs inclusion/exclusion tests on the inclusion/exclusion file. Chisq with no correction, filters for only events with > 5 in each cell.<commit_after>#!/usr/local/bin/python

import numpy as np
import scipy.stats as stats
import sys

def parseIELine(line):
    if line[0] == "#":
        return []
    else:
        x = line.split("\t")
        z = [int(y) for y in x[1:]]
        return [x[0]] + z

def main():
    header = sys.stdin.readline().split("\t")
    for line in sys.stdin:
        x = parseIELine(line)
        z = [(y < 5) for y in x[1:]]
        if True in z:
            continue
        z = np.array([[x[1], x[2]], [x[3], x[4]]])
        c = stats.chi2_contingency(z, correction=False)
        if c[1] < 0.01:
            print line
            print c

if __name__ == "__main__":
    main()
{'fraction_non_alphanumeric': 0.14439140811455847, 'fraction_numerical': 0.017899761336515514, 'mean_word_length': 2.2022900763358777, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 4, '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': '705805', 'n_tokens_mistral': 295, 'n_tokens_neox': 289, 'n_words': 88}