コード例 #1
0
ファイル: grade_utils.py プロジェクト: nader92011/zdotfiles
def grade_2b(text):
    import topic_coherence
    from math import ceil

    family_weight = 1
    work_weight = .5

    family_hits, work_hits, nouns = topic_coherence.parse(text)
    score = (float(family_hits * (5 * family_weight)) / (nouns - 1))
    score += (float(work_hits * (5 * work_weight)) / (nouns - 1))
    return ceil(min(5, score, nouns))
コード例 #2
0
def grade_2b(text):
    import topic_coherence
    from math import ceil

    family_weight = 1
    work_weight = .5

    family_hits, work_hits, nouns = topic_coherence.parse(text)
    score = (float(family_hits * (5 * family_weight)) / (nouns - 1))
    score += (float(work_hits * (5 * work_weight)) / (nouns - 1))
    return ceil(min(5, score, nouns))
コード例 #3
0
ファイル: scoring_utils.py プロジェクト: snyderp/cs412-scorer
    print "Num Problems: {0}".format(sum(sentence_problems))
    print "Sentences with problems: {0}".format(num_sentences_with_problems)
    print "Percent Correct: {0}/{1} ({2})".format(num_sentences - num_sentences_with_problems, num_sentences, 1 - (float(num_sentences_with_problems)/num_sentences))
    print "Score: {0}".format(math.floor((1 - (float(num_sentences_with_problems)/num_sentences)) * 5))
elif agreement_stdin:
    import agreement_utils
    text = cmd_utils.get_stdin().strip()
    print agreement_utils.parse(text)
elif pronoun_stdin:
    import text_coherence
    text = cmd_utils.get_stdin().strip()
    print text_coherence.parse(text)
elif topic_stdin:
    import topic_coherence
    text = cmd_utils.get_stdin().strip()
    print topic_coherence.parse(text)
elif final_score_stdin:
    import grade_utils
    text = cmd_utils.get_stdin().strip()

    print "Grading"
    print "----------"
    print text
    print "----------\n"

    total = 0

    for grade_type in grade_utils.implemented_grades:
        grade_for_test = grade_utils.grade_text(text, grade_type)
        if isinstance(grade_for_test, str):
            print "%s: %s" % (grade_type, grade_for_test)
コード例 #4
0
ファイル: scoring_utils.py プロジェクト: pes10k/cs412-scorer
        1 - (float(num_sentences_with_problems) / num_sentences))
    print "Score: {0}".format(
        math.floor(
            (1 - (float(num_sentences_with_problems) / num_sentences)) * 5))
elif agreement_stdin:
    import agreement_utils
    text = cmd_utils.get_stdin().strip()
    print agreement_utils.parse(text)
elif pronoun_stdin:
    import text_coherence
    text = cmd_utils.get_stdin().strip()
    print text_coherence.parse(text)
elif topic_stdin:
    import topic_coherence
    text = cmd_utils.get_stdin().strip()
    print topic_coherence.parse(text)
elif final_score_stdin:
    import grade_utils
    text = cmd_utils.get_stdin().strip()

    print "Grading"
    print "----------"
    print text
    print "----------\n"

    total = 0

    for grade_type in grade_utils.implemented_grades:
        grade_for_test = grade_utils.grade_text(text, grade_type)
        if isinstance(grade_for_test, str):
            print "%s: %s" % (grade_type, grade_for_test)