mirror of
				https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
				synced 2025-11-03 20:02:47 +00:00 
			
		
		
		
	fix stack deploy yml
This commit is contained in:
		@@ -64,7 +64,19 @@
 | 
				
			|||||||
  <div class="card">
 | 
					  <div class="card">
 | 
				
			||||||
    <div class="card-content">
 | 
					    <div class="card-content">
 | 
				
			||||||
      <span class="card-title">Query Results</span>
 | 
					      <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>
 | 
					  </div>
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
@@ -115,56 +127,54 @@
 | 
				
			|||||||
    M.toast({html: 'Query has been sent!'});
 | 
					    M.toast({html: 'Query has been sent!'});
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  socket.on('corpus_analysis', function(results) {
 | 
					  socket.on('corpus_analysis', function(matches) {
 | 
				
			||||||
    if (results === null) {
 | 
					    if (matches === null) {
 | 
				
			||||||
      M.toast({html: 'Query has no results!'});
 | 
					      M.toast({html: 'Query has no results!'});
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
      console.log(results);
 | 
					      console.log(matches);
 | 
				
			||||||
      html_txt = '<table class="highlight"> <thead><tr><th>Title</th><th>Left context</th><th>Match</th><th>Right Context</th></tr></thead>';
 | 
					      let htmlString = "";
 | 
				
			||||||
      for (let [key, hit] of Object.entries(results)) {
 | 
					      for (let match of Object.values(matches)) {
 | 
				
			||||||
        resultInfo(hit, "word");
 | 
					        niceMatch = matchInfo(match);
 | 
				
			||||||
        var left_context = hit['left_context_cpos']
 | 
					        htmlString += `<tr><td>${niceMatch["text_title"]}</td><td>${niceMatch["left"]}</td><td>${niceMatch["match"]}</td><td>${niceMatch["right"]}</td></tr>`;
 | 
				
			||||||
        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 = '';
 | 
					 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      html_txt += '</table>';
 | 
					      queryResultsElement.innerHTML = htmlString;
 | 
				
			||||||
      queryResultsElement.innerHTML = html_txt;
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  function resultInfo(result) {
 | 
					  function matchInfo(match) {
 | 
				
			||||||
    left = "";
 | 
					    var niceMatch = {"left": "", "match": "", "right": ""};
 | 
				
			||||||
 | 
					    var tmp = Object.values(Object.values(match["match_cpos"])[0])[0];
 | 
				
			||||||
    for (let entry of result['left_context_cpos']) {
 | 
					    niceMatch["text_author"] = tmp["text_author"][1];
 | 
				
			||||||
      let foo = Object.values(entry)[0]
 | 
					    niceMatch["text_title"] = tmp["text_title"][1];
 | 
				
			||||||
      left += foo["simple_pos"] === "PUNCT" ? foo["word"] : " " + foo["word"];
 | 
					    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>';
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    for (let token of Object.values(match['match_cpos'])) {
 | 
				
			||||||
    console.log("Diese andere Info:");
 | 
					      tmp = Object.values(token)[0];
 | 
				
			||||||
    console.log(left);
 | 
					      if (tmp["simple_pos"] != "PUNCT") {niceMatch["match"] += " ";}
 | 
				
			||||||
  }
 | 
					      niceMatch["match"] += '<span class="token" data-cpos="">'
 | 
				
			||||||
 | 
					                            + '<span class="word">' + tmp["word"] + '</span>'
 | 
				
			||||||
  function getResultInfos(matchObject, info_key, slice) {
 | 
					                            + '<span class="pos">' + tmp["pos"] + '</span>'
 | 
				
			||||||
    var infos = [];
 | 
					                            + '<span class="lemma">' + tmp["lemma"] + '</span>'
 | 
				
			||||||
    for (let token of Object.values(matchObject)) {
 | 
					                          + '</span>';
 | 
				
			||||||
        for (let key in token) {
 | 
					 | 
				
			||||||
          infos.push(token[key][info_key]);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if (slice) {
 | 
					    for (let token of Object.values(match['right_context_cpos'])) {
 | 
				
			||||||
      console.log(infos);
 | 
					      tmp = Object.values(token)[0];
 | 
				
			||||||
      var infos = infos[slice];
 | 
					      if (tmp["simple_pos"] != "PUNCT") {niceMatch["right"] += " ";}
 | 
				
			||||||
      return infos;
 | 
					      niceMatch["right"] += '<span class="token">'
 | 
				
			||||||
    } else {
 | 
					                            + '<span class="word">' + tmp["word"] + '</span>'
 | 
				
			||||||
      return infos;
 | 
					                            + '<span class="pos">' + tmp["pos"] + '</span>'
 | 
				
			||||||
 | 
					                            + '<span class="lemma">' + tmp["lemma"] + '</span>'
 | 
				
			||||||
 | 
					                          + '</span>';
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    return niceMatch
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
{% endblock %}
 | 
					{% endblock %}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user