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
Admin message
Looking for advice? Join the
Matrix channel for GitLab users in Bielefeld
!
Show more breadcrumbs
SFB 1288 - INF
nopaque
Commits
a4ffee5b
Commit
a4ffee5b
authored
5 years ago
by
Patrick Jentsch
Browse files
Options
Downloads
Plain Diff
Merge branch 'development' of gitlab.ub.uni-bielefeld.de:sfb1288inf/opaque into development
parents
c6c8a775
d57ced8a
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/corpora/CQiWrapper/CQiWrapper.py
+4
-1
4 additions, 1 deletion
app/corpora/CQiWrapper/CQiWrapper.py
app/corpora/events.py
+16
-1
16 additions, 1 deletion
app/corpora/events.py
app/templates/corpora/analyse_corpus.html.j2
+31
-3
31 additions, 3 deletions
app/templates/corpora/analyse_corpus.html.j2
with
51 additions
and
5 deletions
app/corpora/CQiWrapper/CQiWrapper.py
+
4
−
1
View file @
a4ffee5b
...
...
@@ -294,4 +294,7 @@ class CQiWrapper(CQiClient):
t1
=
time
.
time
()
t_total
=
t1
-
t0
logger
.
warning
(
'
Got all sentences informations in {} seconds
'
.
format
(
t_total
))
return
context_sentences
,
all_cpos_infos
,
text_lookup
match_context
=
{
'
context_s_cpos
'
:
context_sentences
,
'
cpos_lookup
'
:
all_cpos_infos
,
'
text_lookup
'
:
text_lookup
}
return
match_context
This diff is collapsed.
Click to expand it.
app/corpora/events.py
+
16
−
1
View file @
a4ffee5b
...
...
@@ -42,7 +42,7 @@ def corpus_analysis(message):
socketio
.
emit
(
'
query
'
,
'
[424]: Failed Dependency
'
,
room
=
request
.
sid
)
return
"""
Prepare and execute a query
"""
#
Prepare and execute a query
corpus_name
=
'
CORPUS
'
query
=
str
(
message
[
'
query
'
])
result_len
=
int
(
message
[
'
hits_per_page
'
])
...
...
@@ -57,6 +57,21 @@ def corpus_analysis(message):
socketio
.
emit
(
'
corpus_analysis
'
,
results
,
room
=
request
.
sid
)
@socketio.on
(
'
inspect_match
'
)
@login_required
def
inspect_match
(
message
):
client
=
corpus_analysis_clients
.
get
(
request
.
sid
)
if
client
is
None
:
socketio
.
emit
(
'
query
'
,
'
[424]: Failed Dependency
'
,
room
=
request
.
sid
)
return
# Get more context for given match CPOS
match_context
=
client
.
get_sentences
(
message
[
'
cpos
'
],
get_surrounding_s
=
True
,
l_r_s_context_additional_len
=
3
)
socketio
.
emit
(
'
match_context
'
,
match_context
,
room
=
request
.
sid
)
def
corpus_analysis_session_handler
(
app
,
corpus_id
,
session_id
):
with
app
.
app_context
():
'''
Setup analysis session
'''
...
...
This diff is collapsed.
Click to expand it.
app/templates/corpora/analyse_corpus.html.j2
+
31
−
3
View file @
a4ffee5b
...
...
@@ -137,6 +137,16 @@
</div>
</div>
<div id="context-modal" class="modal">
<div class="modal-content">
<h4>Modal Header</h4>
<p>A bunch of text</p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-close waves-effect waves-green btn-flat">Agree</a>
</div>
</div>
<script>
var loadingModal;
document.addEventListener("DOMContentLoaded", function() {
...
...
@@ -196,9 +206,10 @@
queryResultsElement.innerHTML = "";
for (let match of result['matches']) {
for (let
[index,
match
]
of result['matches']
.entries()
) {
matchElement = document.createElement("tr");
matchElement.classList.add("match");
matchElement.dataset.index = index;
matchTextTitlesElement = document.createElement("td");
matchTextTitlesElement.classList.add("text-titles");
matchElement.append(matchTextTitlesElement);
...
...
@@ -237,6 +248,16 @@
tokenElements.push(tokenElement);
textTitles.add(result["text_lookup"][token["text"]]["title"]);
}
var moreContextBtn = document.createElement("a");
moreContextBtn.setAttribute("class", "btn-floating btn waves-effect waves-light teal right");
moreContextBtn.innerHTML = '<i class="material-icons">search</i>';
matchHitElement.append(document.createElement("br"), document.createElement("br"));
matchHitElement.append(moreContextBtn);
moreContextBtn.onclick = function(){
var cpos = match["hit"];
socket.emit("inspect_match", {"cpos": cpos});
};
matchTextTitlesElement.innerText = [...textTitles].join(",");
matchElement.append(matchHitElement);
matchRightContextElement = document.createElement("td");
...
...
@@ -277,15 +298,22 @@
</td>
<td class="left-align">
Title: ${result["text_lookup"][token["text"]]["title"]}<br>
Author: ${result["text_lookup"][token["text"]]["
title
"]}<br>
Author: ${result["text_lookup"][token["text"]]["
author
"]}<br>
Publishing year: ${result["text_lookup"][token["text"]]["publishing_year"]}
</td>
</tr>
</table>`,
"inDuration":
2
500,
"inDuration":
1
500,
"margin": 15,
"position": "top",
"transitionMovement": 0});
}
socket.on("match_context", function(message) {
console.log(message);
var elems = document.querySelectorAll('.modal');
var instances = M.Modal.init(elems);
});
</script>
{% endblock %}
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