mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-24 10:34:17 +00:00
Add more metadata
This commit is contained in:
parent
58295b986d
commit
c49684611a
@ -83,7 +83,7 @@ class Data {
|
|||||||
|
|
||||||
class MetaData {
|
class MetaData {
|
||||||
// Sets empty object structure when no input is given.
|
// Sets empty object structure when no input is given.
|
||||||
// Else it works like a delete.
|
// if json object like input is given class fields are created from this
|
||||||
init(json = {}) {
|
init(json = {}) {
|
||||||
Object.assign(this, json);
|
Object.assign(this, json);
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,5 @@
|
|||||||
function recvMetaData(payload) {
|
function recvMetaData(payload) {
|
||||||
results.metaData.init(payload)
|
results.metaData.init(payload)
|
||||||
// results.metaDataJSON.corpus_name = payload.corpus_name;
|
|
||||||
// results.metaDataJSON.corpus_description = payload.corpus_description;
|
|
||||||
// results.metaDataJSON.corpus_creation_date = payload.corpus_creation_date;
|
|
||||||
// results.metaDataJSON.corpus_last_edited_date = payload.corpus_last_edited_date;
|
|
||||||
// results.metaDataJSON.corpus_properties = payload.corpus_properties;
|
|
||||||
// results.metaDataJSON.corpus_size_tokens = payload.corpus_size_tokens;
|
|
||||||
// results.metaDataJSON.corpus_all_texts = payload.corpus_all_texts;
|
|
||||||
// results.metaDataJSON.corpus_analysis_date = payload.corpus_analysis_date;
|
|
||||||
// results.metaDataJSON.corpus_cqi_py_version = payload.corpus_cqi_py_version;
|
|
||||||
// results.metaDataJSON.corpus_cqpserver_version = payload.corpus_cqpserver_version;
|
|
||||||
console.log(results.metaData);
|
console.log(results.metaData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,6 +168,7 @@ class ResultsList extends List {
|
|||||||
|
|
||||||
//gets result cpos infos for one dataIndex to send back to the server
|
//gets result cpos infos for one dataIndex to send back to the server
|
||||||
inspect(dataIndex) {
|
inspect(dataIndex) {
|
||||||
|
this.contextId = dataIndex;
|
||||||
let contextResultsElement;
|
let contextResultsElement;
|
||||||
contextResultsElement = document.getElementById("context-results");
|
contextResultsElement = document.getElementById("context-results");
|
||||||
contextResultsElement.innerHTML = ""; // clear it from old inspects
|
contextResultsElement.innerHTML = ""; // clear it from old inspects
|
||||||
@ -176,7 +177,7 @@ class ResultsList extends List {
|
|||||||
{
|
{
|
||||||
payload: {
|
payload: {
|
||||||
first_cpos: results.data.matches[dataIndex].c[0],
|
first_cpos: results.data.matches[dataIndex].c[0],
|
||||||
last_cpos: results.data.matches[dataIndex].c[1]
|
last_cpos: results.data.matches[dataIndex].c[1],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -207,17 +208,19 @@ class ResultsList extends List {
|
|||||||
let token;
|
let token;
|
||||||
let tokenHTMLArray;
|
let tokenHTMLArray;
|
||||||
let tokenHTMlElement;
|
let tokenHTMlElement;
|
||||||
|
let uniqueContextS;
|
||||||
let uniqueS;
|
let uniqueS;
|
||||||
|
|
||||||
// TODO: contextData needs some identifier like match Nr to indicate what context this is. Also use this in the filename
|
|
||||||
this.contextData = response.payload;
|
this.contextData = response.payload;
|
||||||
this.contextData["query"] = results.data.query;
|
this.contextData["query"] = results.data.query;
|
||||||
|
this.contextData["context_id"] = this.contextId;
|
||||||
Object.assign(this.contextData, results.metaData);
|
Object.assign(this.contextData, results.metaData);
|
||||||
contextResultsElement = document.getElementById("context-results");
|
contextResultsElement = document.getElementById("context-results");
|
||||||
modalExpertModeSwitchElement = document.getElementById("inspect-display-options-form-expert_mode_inspect");
|
modalExpertModeSwitchElement = document.getElementById("inspect-display-options-form-expert_mode_inspect");
|
||||||
highlightSentencesSwitchElement = document.getElementById("inspect-display-options-form-highlight_sentences");
|
highlightSentencesSwitchElement = document.getElementById("inspect-display-options-form-highlight_sentences");
|
||||||
nrOfContextSentences = document.getElementById("context-sentences");
|
nrOfContextSentences = document.getElementById("context-sentences");
|
||||||
uniqueS = new Set();
|
uniqueS = new Set();
|
||||||
|
uniqueContextS = new Set();
|
||||||
// check if cpos ranges are used or not
|
// check if cpos ranges are used or not
|
||||||
if (this.contextData.cpos_ranges == true) {
|
if (this.contextData.cpos_ranges == true) {
|
||||||
// python range like function from MDN
|
// python range like function from MDN
|
||||||
@ -246,7 +249,8 @@ class ResultsList extends List {
|
|||||||
}
|
}
|
||||||
for (let cpos of c) {
|
for (let cpos of c) {
|
||||||
token = this.contextData.cpos_lookup[cpos];
|
token = this.contextData.cpos_lookup[cpos];
|
||||||
uniqueS.add(token.s)
|
uniqueContextS.add(token.s);
|
||||||
|
uniqueS.add(token.s);
|
||||||
htmlTokenStr = `<span class="token bold light-green"` +
|
htmlTokenStr = `<span class="token bold light-green"` +
|
||||||
`data-sid="${token.s}"` +
|
`data-sid="${token.s}"` +
|
||||||
`data-cpos="${cpos}"` +
|
`data-cpos="${cpos}"` +
|
||||||
@ -256,6 +260,7 @@ class ResultsList extends List {
|
|||||||
tokenHTMlElement = this.HTMLTStrToElement(htmlTokenStr)
|
tokenHTMlElement = this.HTMLTStrToElement(htmlTokenStr)
|
||||||
tokenHTMLArray.push(tokenHTMlElement);
|
tokenHTMLArray.push(tokenHTMlElement);
|
||||||
}
|
}
|
||||||
|
this.contextData["context_s_ids"] = Array.from(uniqueContextS);
|
||||||
for (let cpos of rc) {
|
for (let cpos of rc) {
|
||||||
token = this.contextData.cpos_lookup[cpos];
|
token = this.contextData.cpos_lookup[cpos];
|
||||||
uniqueS.add(token.s)
|
uniqueS.add(token.s)
|
||||||
|
@ -467,7 +467,7 @@
|
|||||||
// add onclick to download JSON button and download the file
|
// add onclick to download JSON button and download the file
|
||||||
downloadInspectContextElement = document.getElementById("inspect-download-context")
|
downloadInspectContextElement = document.getElementById("inspect-download-context")
|
||||||
downloadInspectContextElement.onclick = () => {
|
downloadInspectContextElement.onclick = () => {
|
||||||
let filename = results.data.createDownloadFilename("context");
|
let filename = results.data.createDownloadFilename(`context-id-${results.jsList.contextId}`);
|
||||||
results.data.addData(results.metaData);
|
results.data.addData(results.metaData);
|
||||||
results.data.downloadJSONRessource(filename,
|
results.data.downloadJSONRessource(filename,
|
||||||
results.jsList.contextData,
|
results.jsList.contextData,
|
||||||
|
Loading…
Reference in New Issue
Block a user