2020-03-28 18:29:19 +00:00
|
|
|
from flask import request, render_template
|
|
|
|
from flask_login import login_required
|
|
|
|
from . import corpora
|
2020-04-01 11:44:06 +00:00
|
|
|
from .pj_forms import PJDisplayOptionsForm, PJQueryForm, QueryDownloadForm
|
2020-03-28 18:29:19 +00:00
|
|
|
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'))
|
2020-04-01 11:44:06 +00:00
|
|
|
query_download_form = QueryDownloadForm()
|
2020-03-28 18:29:19 +00:00
|
|
|
return render_template('corpora/pj_analyse_corpus.html.j2',
|
|
|
|
corpus_id=corpus_id,
|
|
|
|
display_options_form=display_options_form,
|
2020-04-01 11:44:06 +00:00
|
|
|
query_form=query_form,
|
|
|
|
query_download_form=query_download_form,
|
|
|
|
title='Corpus analysis')
|