New context options

This commit is contained in:
Stephan Porada
2020-04-15 14:55:29 +02:00
parent 34e8d952b6
commit 9031ca5845
4 changed files with 133 additions and 80 deletions

View File

@ -93,7 +93,7 @@ def corpus_analysis_inspect_match(payload):
try:
corpus = client.corpora.get('CORPUS')
s = corpus.structural_attributes.get('s')
payload = s.export(payload['first_cpos'], payload['last_cpos'], context=3)
payload = s.export(payload['first_cpos'], payload['last_cpos'], context=10)
payload['cpos_ranges'] = True
except cqi.errors.CQiException as e:
payload = {'code': e.code, 'desc': e.description, 'msg': e.name}

View File

@ -1,7 +1,7 @@
from flask_wtf import FlaskForm
from wtforms import (BooleanField, FileField, StringField, SubmitField,
ValidationError, IntegerField, SelectField)
from wtforms.validators import DataRequired, Length
from wtforms.validators import DataRequired, Length, NumberRange
class AddCorpusFileForm(FlaskForm):
@ -88,19 +88,9 @@ class DisplayOptionsForm(FlaskForm):
class InspectDisplayOptionsForm(FlaskForm):
expert_mode_inspect = BooleanField('Expert mode')
highlight_sentences = BooleanField('Highlight sentences')
context_sentences = SelectField('Context sentences',
choices=[('', 'Choose your option'),
('1', '1'),
('2', '2'),
('3', '3'),
('4', '4'),
('5', '5'),
('6', '6'),
('7', '7'),
('8', '8'),
('9', '9'),
('10', '10')],
default=3)
context_sentences = IntegerField('Context sentences',
validators=[NumberRange(min=0, max=10)],
default=3)
class QueryDownloadForm(FlaskForm):