Ejemplo n.º 1
0
def mine_home():
    form = MineForm(request.args)

    ma = MediaAnalyser(doc_ids=form.document_ids(overview=True))
    ma.analyse()

    sa = SourceAnalyser(doc_ids=form.document_ids())
    sa.analyse()
    sa.load_utterances()

    return render_template('mine/index.haml',
                           form=form,
                           source_analyser=sa,
                           media_analyser=ma)
Ejemplo n.º 2
0
def mine_home():
    form = MineForm(request.args)

    ma = MediaAnalyser(doc_ids=form.document_ids(overview=True))
    ma.analyse()

    sa = SourceAnalyser(doc_ids=form.document_ids())
    sa.analyse()
    sa.load_utterances()

    return render_template('mine/index.haml',
                           form=form,
                           source_analyser=sa,
                           media_analyser=ma)
Ejemplo n.º 3
0
def mine_person(id):
    person = Person.query.get_or_404(id)
    form = MineForm(request.args)

    sa = SourceAnalyser(doc_ids=form.document_ids())
    sa.analyse()
    sa.load_utterances([person])

    source = sa.analysed_people.get(person.id)
    if not source:
        return jsonify({'row': '', 'utterances': ''})

    row = render_template('mine/_source.haml', i=-1, source=source)
    utterances = render_template("mine/_quotations.haml", i=-1, source=source, source_analyser=sa)

    return jsonify({
        'row': row,
        'utterances': utterances,
    })
Ejemplo n.º 4
0
def mine_person(id):
    person = Person.query.get_or_404(id)
    form = MineForm(request.args)

    sa = SourceAnalyser(doc_ids=form.document_ids())
    sa.analyse()
    sa.load_utterances([person])

    source = sa.analysed_people.get(person.id)
    if not source:
        return jsonify({'row': '', 'utterances': ''})

    row = render_template('mine/_source.haml', i=-1, source=source)
    utterances = render_template("mine/_quotations.haml",
                                 i=-1,
                                 source=source,
                                 source_analyser=sa)

    return jsonify({
        'row': row,
        'utterances': utterances,
    })