예제 #1
0
def main():
    base_sentiments = parse_afinn.parse_sentiment_file(open(sys.argv[1]))
    tweets = parse_tweets(open(sys.argv[2]))
    student_scores = parse(open(sys.argv[3]))

    solution_scores = []

    for tweet in tweets:
        solution_scores.append(compute_tweet_sentiment(base_sentiments, tweet))

    grade(solution_scores, student_scores)
예제 #2
0
def main():
    pre_sent_file = open(sys.argv[1])
    tweet_file = open(sys.argv[2])
    student_sent_file = open(sys.argv[3])

    pre_sent = parse_afinn.parse_sentiment_file(pre_sent_file)
    solution_sentiments = get_term_sentiments(pre_sent, tweet_file)
    student_sentiments = grade_helper.parse_str_float_lines(student_sent_file)

    grade_helper.check_terms(student_sentiments, solution_sentiments)
    grade(student_sentiments, solution_sentiments)
예제 #3
0
def main():
    sent_file = open(sys.argv[1])
    tweet_file = open(sys.argv[2])
    hap_file = open(sys.argv[3])
    pre_comp_sent = parse_afinn.parse_sentiment_file(sent_file)
    sentiments = sent_grader.get_term_sentiments(pre_comp_sent, tweet_file)
    stdn_hap_state = grade_helper.parse_state(hap_file)

    tweet_file.seek(0)
    soln_hap_state = compute_happiest(sentiments, parse_tweets(tweet_file))

    if stdn_hap_state.lower() != soln_hap_state.lower():
        grade_helper.fail('Student solution returns ' + stdn_hap_state + ' while grader solution returns ' + soln_hap_state)
    else:
        grade_helper.success()