Use matches instead of one match in match context

This commit is contained in:
Stephan Porada 2020-06-16 14:05:58 +02:00
parent af50da4936
commit b427a5e6f1
2 changed files with 9 additions and 6 deletions

View File

@ -22,6 +22,7 @@ class Data {
this["cpos_lookup"] = {}; // object contains all this key value pair
this["text_lookup"] = {}; // same as above for all text ids
this["match_count"] = matchCount;
this["corpus_type"] = "subcorpus"
}
addData(jsonData) {

View File

@ -214,6 +214,8 @@ class ResultsList extends List {
this.contextData = response.payload;
this.contextData["query"] = results.data.query;
this.contextData["context_id"] = this.contextId;
this.contextData["match_count"] = this.contextData.matches.length
this.contextData["corpus_type"] = "sub-subcorpus"
Object.assign(this.contextData, results.metaData);
contextResultsElement = document.getElementById("context-results");
modalExpertModeSwitchElement = document.getElementById("inspect-display-options-form-expert_mode_inspect");
@ -226,13 +228,13 @@ class ResultsList extends List {
// python range like function from MDN
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from#Sequence_generator_(range)
const range = (start, stop, step) => Array.from({ length: (stop - start) / step + 1}, (_, i) => start + (i * step));
lc = range(this.contextData.match.lc[0], this.contextData.match.lc[1], 1)
c = range(this.contextData.match.c[0], this.contextData.match.c[1], 1)
rc = range(this.contextData.match.rc[0], this.contextData.match.rc[1], 1)
lc = range(this.contextData.matches[0].lc[0], this.contextData.matches[0].lc[1], 1)
c = range(this.contextData.matches[0].c[0], this.contextData.matches[0].c[1], 1)
rc = range(this.contextData.matches[0].rc[0], this.contextData.matches[0].rc[1], 1)
} else {
lc = this.contextData.match.lc;
c = this.contextData.match.c;
rc = this.contextData.match.rc;
lc = this.contextData.matches[0].lc;
c = this.contextData.matches[0].c;
rc = this.contextData.matches[0].rc;
}
// create sentence strings as tokens
tokenHTMLArray = [];