This commit is contained in:
Patrick Jentsch 2019-11-25 12:31:48 +01:00
parent 0f23cbe2a2
commit 6c9b43367b

View File

@ -122,6 +122,7 @@
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']
@ -137,10 +138,22 @@
queryResultsElement.innerHTML = html_txt;
}
});
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"];
}
console.log("Diese andere Info:");
console.log(left);
}
function getResultInfos(matchObject, info_key, slice) {
var infos = [];
for (let [infoKey, infoValue] of Object.entries(matchObject)) {
var token = infoValue;
for (let token of Object.values(matchObject)) {
for (let key in token) {
infos.push(token[key][info_key]);
}