Beispiel #1
0
def grade_1d(text):
    import syntactic_formation
    import math
    sentence_problems = syntactic_formation.parse(text)
    num_sentences_with_problems = sum([1 if count > 0 else 0 for count in sentence_problems])
    num_sentences = len(sentence_problems)
    score = max(0, math.floor((1 - (float(num_sentences_with_problems)/num_sentences)) * 5))
    return score
Beispiel #2
0
def grade_1d(text):
    import syntactic_formation
    import math
    sentence_problems = syntactic_formation.parse(text)
    num_sentences_with_problems = sum(
        [1 if count > 0 else 0 for count in sentence_problems])
    num_sentences = len(sentence_problems)
    score = max(
        0,
        math.floor(
            (1 - (float(num_sentences_with_problems) / num_sentences)) * 5))
    return score
Beispiel #3
0
    lines = cmd_utils.get_stdin_lines()
    issues_in_text = []
    for line in lines:
        sentences = sentence_tokenizer.parse_sentences(line)
        for sentence in sentences:
            issues = word_order.issues_in_sentence(sentence, use_cache=False)
            print sentence
            print issues
            issues_in_text += issues
    print "Found %d issues" % (len(issues_in_text),)
    print "Issues: %s" % (issues_in_text,)
elif syntactic_formation_stdin:
    import syntactic_formation
    import math
    text = cmd_utils.get_stdin().strip()
    sentence_problems = syntactic_formation.parse(text)
    num_sentences_with_problems = sum([1 if count > 0 else 0 for count in sentence_problems])
    num_sentences = len(sentence_problems)
    print "Num Sentences: {0}".format(num_sentences)
    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)
Beispiel #4
0
    lines = cmd_utils.get_stdin_lines()
    issues_in_text = []
    for line in lines:
        sentences = sentence_tokenizer.parse_sentences(line)
        for sentence in sentences:
            issues = word_order.issues_in_sentence(sentence, use_cache=False)
            print sentence
            print issues
            issues_in_text += issues
    print "Found %d issues" % (len(issues_in_text), )
    print "Issues: %s" % (issues_in_text, )
elif syntactic_formation_stdin:
    import syntactic_formation
    import math
    text = cmd_utils.get_stdin().strip()
    sentence_problems = syntactic_formation.parse(text)
    num_sentences_with_problems = sum(
        [1 if count > 0 else 0 for count in sentence_problems])
    num_sentences = len(sentence_problems)
    print "Num Sentences: {0}".format(num_sentences)
    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()