Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
nopaque
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SFB 1288 - INF
nopaque
Commits
11524174
Commit
11524174
authored
5 years ago
by
Patrick Jentsch
Browse files
Options
Downloads
Patches
Plain Diff
First output of query results
parent
28171eb5
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/corpora/events.py
+3
-2
3 additions, 2 deletions
app/corpora/events.py
app/templates/corpora/corpus_analysis.html.j2
+5
-6
5 additions, 6 deletions
app/templates/corpora/corpus_analysis.html.j2
with
8 additions
and
8 deletions
app/corpora/events.py
+
3
−
2
View file @
11524174
...
...
@@ -43,13 +43,13 @@ def recv_query(message):
analysis_client
=
analysis_clients
[
request
.
sid
]
"""
Prepare and execute a query
"""
corpus
=
'
CORPUS
'
query
=
'"
and
"
;
'
query
=
message
[
'
query
'
]
query_subcorpus
=
'
Results
'
analysis_client
.
cqp_query
(
corpus
,
query_subcorpus
,
query
)
"""
Evaluate query results
"""
match_corpus
=
'
{}:{}
'
.
format
(
corpus
,
query_subcorpus
)
match_num
=
analysis_client
.
cqp_subcorpus_size
(
match_corpus
)
match_num
=
min
(
1
9
,
match_num
)
match_num
=
min
(
int
(
message
[
'
hits_per_page
'
])
-
1
,
match_num
)
if
match_num
==
0
:
print
(
'
No matches found.
'
)
exit
()
...
...
@@ -67,6 +67,7 @@ def recv_query(message):
pos
=
analysis_client
.
cl_cpos2str
(
'
{}.pos
'
.
format
(
corpus
),
range
(
match_start
,
match_end
+
1
))
matches
.
append
({
'
tokens
'
:
tokens
,
'
pos
'
:
pos
})
logger
.
warning
(
matches
)
socketio
.
emit
(
'
query_results
'
,
matches
,
room
=
request
.
sid
)
def
observe_corpus_analysis_connection
(
app
,
corpus_id
,
session_id
):
...
...
This diff is collapsed.
Click to expand it.
app/templates/corpora/corpus_analysis.html.j2
+
5
−
6
View file @
11524174
...
...
@@ -76,18 +76,17 @@
socket.on('query_results', function(json_results) {
console.log('Results recieved')
console.log(json_results)
let json_results = json_results;
var queryResultsElement = document.getElementById("query-results");
for (let json_result of json_results) {
queryResultsElement.innerHTML += json_result['tokens'] + '<br>';
}
});
</script>
<div class="col s12 m9 l9">
<div class="card">
<div class="card-content">
<span class="card-title">Query Results</span>
<table class="responsive highlight">
{% for hit in json_results %}
{% endfor %}
</table>
<p id="query-results"></p>
</div>
</div>
</div>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment