{"action":"opened","issue":{"url":"https://api.github.com/repos/programminghistorian/ph-submissions/issues/177","repository_url":"https://api.github.com/repos/programminghistorian/ph-submissions","labels_url":"https://api.github.com/repos/programminghistorian/ph-submissions/issues/177/labels{/name}","comments_url":"https://api.github.com/repos/programminghistorian/ph-submissions/issues/177/comments","events_url":"https://api.github.com/repos/programminghistorian/ph-submissions/issues/177/events","html_url":"https://github.com/programminghistorian/ph-submissions/issues/177","id":330295356,"node_id":"MDU6SXNzdWUzMzAyOTUzNTY=","number":177,"title":"Missing line of code - Stylometric Lesson","user":{"login":"rrkelley1225","id":4340529,"node_id":"MDQ6VXNlcjQzNDA1Mjk=","avatar_url":"https://avatars3.githubusercontent.com/u/4340529?v=4","gravatar_id":"","url":"https://api.github.com/users/rrkelley1225","html_url":"https://github.com/rrkelley1225","followers_url":"https://api.github.com/users/rrkelley1225/followers","following_url":"https://api.github.com/users/rrkelley1225/following{/other_user}","gists_url":"https://api.github.com/users/rrkelley1225/gists{/gist_id}","starred_url":"https://api.github.com/users/rrkelley1225/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rrkelley1225/subscriptions","organizations_url":"https://api.github.com/users/rrkelley1225/orgs","repos_url":"https://api.github.com/users/rrkelley1225/repos","events_url":"https://api.github.com/users/rrkelley1225/events{/privacy}","received_events_url":"https://api.github.com/users/rrkelley1225/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-07T14:22:13Z","updated_at":"2018-06-07T14:22:13Z","closed_at":null,"author_association":"NONE","body":"\r\nThanks for the tutorial. I think there is a line of code missing in the Burrows' Delta Method section on the website. The following code fails because the features list is never created:\r\n\r\n# The main data structure\r\nfeature_freqs = {}\r\n\r\nfor author in authors:\r\n    # A dictionary for each candidate's features\r\n    feature_freqs[author] = {} \r\n    \r\n    # A helper value containing the number of tokens in the author's subcorpus\r\n    overall = len(federalist_by_author_tokens[author])\r\n    \r\n    # Calculate each feature's presence in the subcorpus\r\n    for feature in features:\r\n        presence = federalist_by_author_tokens[author].count(feature)\r\n        feature_freqs[author][feature] = presence / overall\r\n\r\nTo fix, I had to add: **features = [f[0] for f in whole_corpus_freq_dist]**\r\nRob\r\n"}}
{"actor":{"display_login":"rrkelley1225"}}