import hmm_utils import cmd_utils import parsers def round_to(n, precission): correction = 0.5 if n >= 0 else -0.5 return int(n/precission+correction)*precission counts = hmm_utils.get_transition_counts() # Flags that note that incode should be looked for in STDIN instead of # in a test essay file grade_directory = cmd_utils.cmd_arg('--dir', None) final_score_stdin = cmd_utils.cmd_flag('--final-score', None) parse_stdin = cmd_utils.cmd_flag('--parse', None) score_stdin = cmd_utils.cmd_flag('--score', None) pronoun_stdin = cmd_utils.cmd_flag('--pronoun', None) topic_stdin = cmd_utils.cmd_flag('--topic', None) syntactic_formation_stdin = cmd_utils.cmd_flag('--syn-formation', None) agreement_stdin = cmd_utils.cmd_flag('--agree', None) sentence_parse_stdin = cmd_utils.cmd_flag('--sen-token', None) word_order_parse_stdin = cmd_utils.cmd_flag('--word-order', None) transition_count = cmd_utils.cmd_arg('--count', None) transition_prob = cmd_utils.cmd_arg('--prob', None) if grade_directory:
import hmm_utils import cmd_utils import parsers def round_to(n, precission): correction = 0.5 if n >= 0 else -0.5 return int(n / precission + correction) * precission counts = hmm_utils.get_transition_counts() # Flags that note that incode should be looked for in STDIN instead of # in a test essay file grade_directory = cmd_utils.cmd_arg('--dir', None) final_score_stdin = cmd_utils.cmd_flag('--final-score', None) parse_stdin = cmd_utils.cmd_flag('--parse', None) score_stdin = cmd_utils.cmd_flag('--score', None) pronoun_stdin = cmd_utils.cmd_flag('--pronoun', None) topic_stdin = cmd_utils.cmd_flag('--topic', None) syntactic_formation_stdin = cmd_utils.cmd_flag('--syn-formation', None) agreement_stdin = cmd_utils.cmd_flag('--agree', None) sentence_parse_stdin = cmd_utils.cmd_flag('--sen-token', None) word_order_parse_stdin = cmd_utils.cmd_flag('--word-order', None) transition_count = cmd_utils.cmd_arg('--count', None) transition_prob = cmd_utils.cmd_arg('--prob', None) if grade_directory: import os import grade_utils
(2, 2, 2, 1,), (1, 2, 1, 2,), (3, 3, 2, 2,), (2, 3,), (2, 2, 1,), # 15 (1, 1, 1, 3, 1), (2, 1,), (2, 2, 1,), (2, 3,), (2, 2, 2, 2), # 20 ) counts = hmm_utils.get_transition_counts() essay_index = int(cmd_utils.cmd_arg('--essay', 0)) - 1 line_index = int(cmd_utils.cmd_arg('--line', -1)) use_stdin = cmd_utils.cmd_flag('--stdin') # How much to prefer long answers over shorter onces weight = .0001 invalid_boundary_tags = ('IN', 'CC', 'SINV', 'RP', 'TO') pers_pro_tags = ('PRP', 'PRP$') start_pers_pro_weight = 1000 def _possible_sentences_in_line(line, min_sentence_len=3): # The simplest thing here is to defer to the paper. If it looks like they've # added punctuation already, lets just use that has_abbr = sum([1 if len(word) > 0 and word[-1] == "." and word.count(".") > 1 else 0 for word in line.split(" ")]) if not has_abbr and line.count(". ") > 0:
( 2, 2, 1, ), ( 2, 3, ), (2, 2, 2, 2), # 20 ) counts = hmm_utils.get_transition_counts() essay_index = int(cmd_utils.cmd_arg('--essay', 0)) - 1 line_index = int(cmd_utils.cmd_arg('--line', -1)) use_stdin = cmd_utils.cmd_flag('--stdin') # How much to prefer long answers over shorter onces weight = .0001 invalid_boundary_tags = ('IN', 'CC', 'SINV', 'RP', 'TO') pers_pro_tags = ('PRP', 'PRP$') start_pers_pro_weight = 1000 def _possible_sentences_in_line(line, min_sentence_len=3): # The simplest thing here is to defer to the paper. If it looks like they've # added punctuation already, lets just use that has_abbr = sum([ 1 if len(word) > 0 and word[-1] == "." and word.count(".") > 1 else 0 for word in line.split(" ")