Пример #1
0
def view_handler():
    return computations.make_literal_term(askers.answer_is(
                computations.askQ_literal(views.predict_output(
                    computations.askQ_literal(views.get_starting_view(
                        computations.getvar(computations.quote(question_var))
                    ))
                ))
            ))
Пример #2
0
def interpret_raw(asker, view, text, bindings):
    #FIXME I think that most field lookups should be done implicitly
    variable_bindings = fields.get(asker, bindings_field(), view)
    lookup_value = asker.ask(fields.get_field(
        dictionaries.image(text), 
        variable_bindings
    ))
    if lookup_value.has_answer():
        return asker.reply(answer=lookup_value.answer)
    update_bindings = dictionaries.map(
        computations.apply_to_single(
            computations.askQ_literal(interpret_expression(
                computations.quote(view),
                computations.getvar(computations.quote(computations.x_var))
            )),
            computations.x_var
        )
    )
    return asker.reply(answer=representations.quoted_term(
        text, 
        functions.apply(update_bindings, bindings)
    ))
    #FIXME should have other answers soon, not everything should be held...
    return elicit_meaning(text, view, functions.apply(update_bindings, bindings))