mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-24 02:24:20 +00:00
Clean up
This commit is contained in:
parent
0d441a9364
commit
dfd9d09f3f
@ -49,22 +49,6 @@ class CQiWrapper(CQiClient):
|
||||
self.attr_strings['struct_attrs'][struct_attr] = (self.corpus_name
|
||||
+ '.'
|
||||
+ struct_attr)
|
||||
# self.word_str = corpus_name + '.word'
|
||||
# self.lemma_str = corpus_name + '.lemma'
|
||||
# self.pos_str = corpus_name + '.pos'
|
||||
# self.sem_str = corpus_name + '.sem'
|
||||
# self.entry_str = corpus_name + '.entry'
|
||||
# self.entry_author_str = self.entry_str + '_author'
|
||||
# self.entry_title_str = self.entry_str + '_title'
|
||||
# self.attributes = [self.word_str,
|
||||
# self.lemma_str,
|
||||
# self.pos_str,
|
||||
# self.sem_str,
|
||||
# self.entry_str,
|
||||
# self.entry_author_str,
|
||||
# self.entry_title_str]
|
||||
# print(self.attributes)
|
||||
|
||||
def set_corpus_name(self, corpus_name):
|
||||
self.corpus_name = corpus_name
|
||||
|
||||
@ -223,21 +207,6 @@ class CQiWrapper(CQiClient):
|
||||
host=self.host, port=self.port)
|
||||
tmp_session.connect()
|
||||
match = self.get_cpos_info(index_pair, tmp_session)
|
||||
# tokens = tmp_session.cl_cpos2str(self.attr_strings['positional_attrs']['word'],
|
||||
# range(index_pair[0],
|
||||
# index_pair[1] + 1))
|
||||
# lemmas = tmp_session.cl_cpos2str(self.attr_strings['positional_attrs']['lemma'],
|
||||
# range(index_pair[0],
|
||||
# index_pair[1] + 1))
|
||||
# pos_tags = tmp_session.cl_cpos2str(self.attr_strings['positional_attrs']['pos'],
|
||||
# range(index_pair[0],
|
||||
# index_pair[1] + 1))
|
||||
# sem_tags = tmp_session.cl_cpos2str(self.attr_strings['positional_attrs']['sem'],
|
||||
# range(index_pair[0],
|
||||
# index_pair[1] + 1))
|
||||
# struc_entry = tmp_session.cl_cpos2struc(self.attr_strings['struct_attrs']['entry'],
|
||||
# range(index_pair[0],
|
||||
# index_pair[1] + 1))
|
||||
before_index = max([0, index_pair[0] - self.context_len])
|
||||
after_index = min([self.corpus_max_len,
|
||||
index_pair[1] + self.context_len])
|
||||
@ -247,10 +216,6 @@ class CQiWrapper(CQiClient):
|
||||
context_after = tmp_session.cl_cpos2str(self.attr_strings['positional_attrs']['word'],
|
||||
range(index_pair[1] + 1,
|
||||
after_index + 1))
|
||||
# entry_titles = tmp_session.cl_struc2str(self.attr_strings['struct_attrs']['entry_title'],
|
||||
# struc_entry)
|
||||
# entry_authors = tmp_session.cl_struc2str(self.attr_strings['struct_attrs']['entry_author'],
|
||||
# struc_entry)
|
||||
tmp_dict = {'context_before': context_before,
|
||||
'context_after': context_after,
|
||||
'cpos_start': index_pair[0],
|
||||
|
@ -27,7 +27,6 @@ class AddCorpusForm(FlaskForm):
|
||||
|
||||
class EditCorpusFileForm(FlaskForm):
|
||||
author = StringField('Author', validators=[DataRequired(), Length(1, 64)])
|
||||
#corpus_file_id = IntegerField('', validators=[DataRequired()])
|
||||
publishing_year = IntegerField('Publishing year',
|
||||
validators=[DataRequired()])
|
||||
submit = SubmitField()
|
||||
@ -36,7 +35,7 @@ class EditCorpusFileForm(FlaskForm):
|
||||
|
||||
class QueryForm(FlaskForm):
|
||||
query = TextAreaField('CQP Query', validators=[DataRequired(),
|
||||
(Length(1, 1024))])
|
||||
(Length(1, 1024))])
|
||||
hits_per_page = SelectField('Hits per page',
|
||||
choices=[('', 'Nr. of hits per page'),
|
||||
('10', '10'),
|
||||
|
@ -62,16 +62,10 @@ def corpus_analysis(corpus_id):
|
||||
dl_form = QueryDownloadForm()
|
||||
form = QueryForm(hits_per_page=hits_per_page, context=context, query=query)
|
||||
if form.validate_on_submit():
|
||||
logger.warning('Data has been sent!')
|
||||
logger.warning('Data labels: {data}'.format(data=[data for data in form.data]))
|
||||
logger.warning('Query Second: {q}'.format(q=form.query.data))
|
||||
logger.warning('Hits: {hits}'.format(hits=form.hits_per_page.data))
|
||||
logger.warning('Context: {context}'.format(context=form.context.data))
|
||||
flash('Query has been sent!')
|
||||
query = form.query.data
|
||||
hits_per_page = form.hits_per_page.data
|
||||
context = form.context.data
|
||||
logger.warning('Query Thrid: {sq}'.format(sq=query))
|
||||
return redirect(url_for('corpora.corpus_analysis', corpus_id=corpus_id,
|
||||
query=query, hits_per_page=hits_per_page,
|
||||
context=context))
|
||||
@ -115,7 +109,9 @@ def add_corpus_file(corpus_id):
|
||||
dir, filename))
|
||||
|
||||
corpus_file = CorpusFile(author=add_corpus_file_form.author.data,
|
||||
corpus=corpus, dir=dir, filename=filename,
|
||||
corpus=corpus,
|
||||
dir=dir,
|
||||
filename=filename,
|
||||
publishing_year=add_corpus_file_form.publishing_year.data,
|
||||
title=add_corpus_file_form.title.data)
|
||||
db.session.add(corpus_file)
|
||||
@ -163,7 +159,8 @@ def download_corpus_file(corpus_id, corpus_file_id):
|
||||
filename=corpus_file.filename)
|
||||
|
||||
|
||||
@corpora.route('/<int:corpus_id>/files/<int:corpus_file_id>/edit', methods=['GET', 'POST'])
|
||||
@corpora.route('/<int:corpus_id>/files/<int:corpus_file_id>/edit',
|
||||
methods=['GET', 'POST'])
|
||||
@login_required
|
||||
def edit_corpus_file(corpus_id, corpus_file_id):
|
||||
corpus_file = CorpusFile.query.get_or_404(corpus_file_id)
|
||||
|
@ -118,7 +118,8 @@ function sendQueryData() {
|
||||
}
|
||||
console.log(query_data)
|
||||
socket.emit('query_event', query_data);
|
||||
console.log('Query data has been sent!')
|
||||
M.toast({html: 'Query has been sent'});
|
||||
console.log('Query data has been sent!');
|
||||
}
|
||||
</script>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user