예제 #1
0
파일: views.py 프로젝트: kcarnold/commons
def make_question(relation, concept, slot):
    rel = RelationType.objects.get(name=relation)
    frame = rel.preferred_frame(en)
    concept = Concept.get_raw(concept, en)
    partial = PartialInference(en, rel, concept, slot)
    parts = partial.fill_in('it', question=True)
    return fill_in_nums(parts[1], parts[0], parts[2])
예제 #2
0
파일: views.py 프로젝트: kcarnold/commons
def assertion_from_text_and_feature(text, feature, score, lang, user):
    partial = PartialInference.from_feature(lang=lang, feature=feature)
    left, frame, right, frame_id = partial.fill_in(text)
    frame = Frame.objects.get(id=frame_id)

    if score == 1: value = RatingValue.objects.get(id=2)
    elif score == -1: value = RatingValue.objects.get(id=5)
    else: raise ValueError("unexpected score: %d" % score)
    a = Assertion.from_frame(user, frame, left, right, activity,
    Batch.objects.get(id=157), value)
    return a