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
5336eac2
Commit
5336eac2
authored
5 years ago
by
Patrick Jentsch
Browse files
Options
Downloads
Patches
Plain Diff
fix stack deploy yml
parent
7edd6355
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/templates/corpora/analyse_corpus.html.j2
+52
-42
52 additions, 42 deletions
app/templates/corpora/analyse_corpus.html.j2
with
52 additions
and
42 deletions
app/templates/corpora/analyse_corpus.html.j2
+
52
−
42
View file @
5336eac2
...
...
@@ -64,7 +64,19 @@
<div class="card">
<div class="card-content">
<span class="card-title">Query Results</span>
<div id="query-results"></div>
<div>
<table class="highlight">
<thead>
<tr>
<th>Title</th>
<th>Left context</th>
<th>Match</th>
<th>Right Context</th>
</tr>
</thead>
<tbody id="query-results"></tbody>
</table>
</div>
</div>
</div>
</div>
...
...
@@ -115,56 +127,54 @@
M.toast({html: 'Query has been sent!'});
});
socket.on('corpus_analysis', function(
result
s) {
if (
result
s === null) {
socket.on('corpus_analysis', function(
matche
s) {
if (
matche
s === null) {
M.toast({html: 'Query has no results!'});
} else {
console.log(results);
html_txt = '<table class="highlight"> <thead><tr><th>Title</th><th>Left context</th><th>Match</th><th>Right Context</th></tr></thead>';
for (let [key, hit] of Object.entries(results)) {
resultInfo(hit, "word");
var left_context = hit['left_context_cpos']
var match = hit['match_cpos']
var right_context = hit['right_context_cpos']
var l_text = getResultInfos(left_context, 'word')
var m_text = getResultInfos(match, 'word')
var r_text = getResultInfos(right_context, 'word')
var match_source = getResultInfos(match, 'text_title', 1)
html_txt += '<tr> <td>' + match_source + '</td><td>' + l_text + '</td><td>' + m_text + '</td><td>' + r_text + '</td></tr>';
l_text = '';
m_text = '';
console.log(matches);
let htmlString = "";
for (let match of Object.values(matches)) {
niceMatch = matchInfo(match);
htmlString += `<tr><td>${niceMatch["text_title"]}</td><td>${niceMatch["left"]}</td><td>${niceMatch["match"]}</td><td>${niceMatch["right"]}</td></tr>`;
}
html_txt += '</table>';
queryResultsElement.innerHTML = html_txt;
queryResultsElement.innerHTML = htmlString;
}
});
function resultInfo(result) {
left = "";
for (let entry of result['left_context_cpos']) {
let foo = Object.values(entry)[0]
left += foo["simple_pos"] === "PUNCT" ? foo["word"] : " " + foo["word"];
function matchInfo(match) {
var niceMatch = {"left": "", "match": "", "right": ""};
var tmp = Object.values(Object.values(match["match_cpos"])[0])[0];
niceMatch["text_author"] = tmp["text_author"][1];
niceMatch["text_title"] = tmp["text_title"][1];
niceMatch["publishing_year"] = tmp["text_publishing_year"][1];
for (let token of Object.values(match['left_context_cpos'])) {
tmp = Object.values(token)[0];
if (tmp["simple_pos"] != "PUNCT") {niceMatch["left"] += " ";}
niceMatch["left"] += '<span class="token">'
+ '<span class="word">' + tmp["word"] + '</span>'
+ '<span class="pos">' + tmp["pos"] + '</span>'
+ '<span class="lemma">' + tmp["lemma"] + '</span>'
+ '</span>';
}
console.log("Diese andere Info:");
console.log(left);
}
function getResultInfos(matchObject, info_key, slice) {
var infos = [];
for (let token of Object.values(matchObject)) {
for (let key in token) {
infos.push(token[key][info_key]);
}
for (let token of Object.values(match['match_cpos'])) {
tmp = Object.values(token)[0];
if (tmp["simple_pos"] != "PUNCT") {niceMatch["match"] += " ";}
niceMatch["match"] += '<span class="token" data-cpos="">'
+ '<span class="word">' + tmp["word"] + '</span>'
+ '<span class="pos">' + tmp["pos"] + '</span>'
+ '<span class="lemma">' + tmp["lemma"] + '</span>'
+ '</span>';
}
if (slice) {
console.log(infos);
var infos = infos[slice];
return infos;
} else {
return infos;
for (let token of Object.values(match['right_context_cpos'])) {
tmp = Object.values(token)[0];
if (tmp["simple_pos"] != "PUNCT") {niceMatch["right"] += " ";}
niceMatch["right"] += '<span class="token">'
+ '<span class="word">' + tmp["word"] + '</span>'
+ '<span class="pos">' + tmp["pos"] + '</span>'
+ '<span class="lemma">' + tmp["lemma"] + '</span>'
+ '</span>';
}
return niceMatch
}
</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