<jupyter_start><jupyter_text>HeuristicsWe are going to build a profile of a person's writing based on basic heuristics such as word to period ratio and comma to period ratio. This will be very inaccurate but will serve as a benchmark for future methods of determining characteristics of a person's writing.We will use data from https://u.cs.biu.ac.il/~koppel/BlogCorpus.htm to do our tests.<jupyter_code>tree = ET.parse('example.xml')

posts = tree.findall('post')
posts = [post.text for post in posts]

post1 = open('1.txt').read()
post2 = open('2.txt').read()

posts = [
    post1,
    post2
]

posts
parsedPosts = [ParsedDoc(post) for post in posts]
postData = np.array([[post.getPToWRatio(), post.getAverageWordLength()] for post in parsedPosts])
profile = postData[:-1]
profileMean = profile.sum(axis=0) / len(profile)
profileSquaredMean = (profile**2).sum(axis=0) / len(profile)
profileSD = np.sqrt(profileSquaredMean - profileMean**2)
postDataStandardized = (postData - profileMean) / profileSD
lastEssayABS = abs(postDataStandardized[-1])

pValues = 1. - (norm.cdf(lastEssayABS) - norm.cdf(-1 * lastEssayABS))
pValues *= 100
pValues

print(pValues)<jupyter_output>[0. 0.]
StarcoderdataJupyterStructuredCleanDedup