<commit_before>#!/usr/bin/env python

"""
Plot histograms of the HW0 self-assessment results.
"""

import yaml
import numpy as np
import matplotlib.pyplot as plt


def gather_scores(recs, name):
    """Gather a set of 1-5 scores from student response records

    Args:
        recs: list of student responses
        name: name of self-assessment score to consider

    Returns:
        length-5 histogram of how many self-assessed as levels 1-5
    """
    scores = np.zeros(5)
    for rec in recs:
        scores[int(rec[name]-1)] += 1
    return scores


def score_plot(recs, name):
    """Produce a histogram plot file for a HW0 score.

    Args:
        recs: list of student responses
        name: name of self-assessment score to consider
    """
    ind = np.arange(5)+1
    scores = gather_scores(recs, name)
    plt.figure()<commit_msg>Modified plot to deal with missing entries.<commit_after>#!/usr/bin/env python

"""
Plot histograms of the HW0 self-assessment results.
"""

import yaml
import numpy as np
import matplotlib.pyplot as plt


def gather_scores(recs, name):
    """Gather a set of 1-5 scores from student response records

    Args:
        recs: list of student responses
        name: name of self-assessment score to consider

    Returns:
        length-5 histogram of how many self-assessed as levels 1-5
    """
    scores = np.zeros(5)
    for rec in recs:
        if name in rec:
            scores[int(rec[name]-1)] += 1
    return scores


def score_plot(recs, name):
    """Produce a histogram plot file for a HW0 score.

    Args:
        recs: list of student responses
        name: name of self-assessment score to consider
    """
    ind = np.arange(5)+1
    scores = gather_scores(recs, name)
    plt.figure()
{'fraction_non_alphanumeric': 0.08893956670467502, 'fraction_numerical': 0.013683010262257697, 'mean_word_length': 2.641078838174274, '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': '41103', 'n_tokens_mistral': 566, 'n_tokens_neox': 529, 'n_words': 201}