Exemplo n.º 1
0
def add_assertion(request, user, frame, text1, text2, activity, rating=1):
    # FIXME: this could happen on user input, so do something more intelligent
    # than an assert.
    
    assert text1 != text2
    raw = RawAssertion.make(user, frame, text1, text2, activity, rating)
    raw.batch = THE_BATCH
    raw.save()
    return raw.assertion
Exemplo n.º 2
0
    counts['success'] += 1
    good_out.write(line)
    if make:
        frametext = "{1} " + relation[3:] + " {2}"
        rel_obj = Relation.objects.get(name=rel)
        frames = Frame.objects.filter(language=en, text=frametext, relation=rel_obj)
        if len(frames) > 0:
            # we want the first one; too bad there are duplicates right now
            frame = frames[0]
            created = False
        else:
            # fall back on what we did before
            frame, created = Frame.objects.get_or_create(language=en, text=frametext, relation=rel_obj, defaults=dict(frequency=adverb, goodness=2))
        if created: print "CREATED:", frame

        print RawAssertion.make(user, frame, left, right, activity)
    else:
        print left, relation[3:], right, score

print counts

flag_out.close()
good_out.close()
weak_out.close()
similar_out.close()

simout = open('similarity-scores.txt', 'w')
for sim in text_similarities:
    print >> simout, sim
simout.close()