mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-27 03:44:19 +00:00
26 lines
1.0 KiB
Python
26 lines
1.0 KiB
Python
|
from flask import request, render_template
|
||
|
from flask_login import login_required
|
||
|
from . import corpora
|
||
|
from .pj_forms import PJDisplayOptionsForm, PJQueryForm
|
||
|
from .. import db
|
||
|
from ..models import Corpus
|
||
|
|
||
|
|
||
|
@corpora.route('/<int:corpus_id>/pj_analyse')
|
||
|
@login_required
|
||
|
def pj_analyse_corpus(corpus_id):
|
||
|
corpus = Corpus.query.get_or_404(corpus_id)
|
||
|
if corpus.status == 'prepared':
|
||
|
corpus.status = 'start analysis'
|
||
|
db.session.commit()
|
||
|
display_options_form = PJDisplayOptionsForm(
|
||
|
prefix='display-options-form',
|
||
|
result_context=request.args.get('context', 20),
|
||
|
results_per_page=request.args.get('results_per_page', 30))
|
||
|
query_form = PJQueryForm(prefix='query-form',
|
||
|
query=request.args.get('query'))
|
||
|
return render_template('corpora/pj_analyse_corpus.html.j2',
|
||
|
corpus_id=corpus_id,
|
||
|
display_options_form=display_options_form,
|
||
|
query_form=query_form, title='Corpus analysis')
|