mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-11-15 01:05:42 +00:00
Final prototype
This commit is contained in:
parent
5cbc6ea822
commit
4497567de0
@ -4,11 +4,11 @@ class ConcordanceQueryBuilder {
|
||||
|
||||
|
||||
this.positionalAttrList = {
|
||||
'emptyToken': {prettyText: 'empty token', cqlOpening: '[', tokenValue:'', cqlClosing: ']'},
|
||||
'word': {prettyText: 'word', cqlOpening: '[word=', tokenValue: '', cqlClosing: ']'},
|
||||
'lemma': {prettyText: 'lemma', cqlOpening: '[lemma=', tokenValue:'', cqlClosing: ']'},
|
||||
'pos': {prettyText: 'pos', cqlOpening: '[pos=', tokenValue:'', cqlClosing: ']'},
|
||||
'simplePos': {prettyText: 'simple_pos', cqlOpening: '[simple_pos=', tokenValue:'', cqlClosing: ']'}
|
||||
"emptyToken": {prettyText: "empty token", cqlOpening: "[", tokenValue:"", cqlClosing: "]"},
|
||||
"word": {prettyText: "word", cqlOpening: "[word=", tokenValue: "", cqlClosing: "]"},
|
||||
"lemma": {prettyText: "lemma", cqlOpening: "[lemma=", tokenValue:"", cqlClosing: "]"},
|
||||
"pos": {prettyText: "pos", cqlOpening: "[pos=", tokenValue:"", cqlClosing: "]"},
|
||||
"simplePos": {prettyText: "simple_pos", cqlOpening: "[simple_pos=", tokenValue:"", cqlClosing: "]"}
|
||||
}
|
||||
|
||||
this.elements = {
|
||||
@ -18,138 +18,148 @@ class ConcordanceQueryBuilder {
|
||||
queryContent:[],
|
||||
|
||||
//#region QueryBuilder Elements
|
||||
concordanceQueryBuilder: document.querySelector('#concordance-query-builder'),
|
||||
concordanceQueryBuilderButton: document.querySelector('#concordance-query-builder-button'),
|
||||
positionalAttr: document.querySelector('#token-attr'),
|
||||
structuralAttr: document.querySelector('#structural-attr'),
|
||||
buttonPreparer: document.querySelector('#button-preparer'),
|
||||
yourQuery: document.querySelector('#your-query'),
|
||||
insertQueryButton: document.querySelector('#insert-query-button'),
|
||||
tokenQuery: document.querySelector('#token-query'),
|
||||
tokenBuilderContent: document.querySelector('#token-builder-content'),
|
||||
buildTokenButton: document.querySelector('#build-token-button'),
|
||||
concordanceQueryBuilder: document.querySelector("#concordance-query-builder"),
|
||||
concordanceQueryBuilderButton: document.querySelector("#concordance-query-builder-button"),
|
||||
positionalAttr: document.querySelector("#token-attr"),
|
||||
structuralAttr: document.querySelector("#structural-attr"),
|
||||
buttonPreparer: document.querySelector("#button-preparer"),
|
||||
yourQuery: document.querySelector("#your-query"),
|
||||
insertQueryButton: document.querySelector("#insert-query-button"),
|
||||
tokenQuery: document.querySelector("#token-query"),
|
||||
tokenBuilderContent: document.querySelector("#token-builder-content"),
|
||||
buildTokenButton: document.querySelector("#build-token-button"),
|
||||
extFormQuery: document.querySelector('#concordance-extension-form-query'),
|
||||
|
||||
|
||||
//#endregion QueryBuilder Elements
|
||||
|
||||
//#region Strucutral Attributes
|
||||
|
||||
sentence:document.querySelector('#sentence'),
|
||||
entity: document.querySelector('#entity'),
|
||||
textAnnotation: document.querySelector('#text-annotation'),
|
||||
sentence:document.querySelector("#sentence"),
|
||||
entity: document.querySelector("#entity"),
|
||||
textAnnotation: document.querySelector("#text-annotation"),
|
||||
|
||||
entityBuilder: document.querySelector('#entity-builder'),
|
||||
englishEntType: document.querySelector('#english-ent-type'),
|
||||
emptyEntity: document.querySelector('#empty-entity'),
|
||||
entityBuilder: document.querySelector("#entity-builder"),
|
||||
englishEntType: document.querySelector("#english-ent-type"),
|
||||
germanEntType: document.querySelector("#german-ent-type"),
|
||||
emptyEntity: document.querySelector("#empty-entity"),
|
||||
entityAnyType: false,
|
||||
|
||||
textAnnotationBuilder: document.querySelector('#text-annotation-builder'),
|
||||
textAnnotationOptions: document.querySelector('#text-annotation-options'),
|
||||
textAnnotationInput: document.querySelector('#text-annotation-input'),
|
||||
textAnnotationSubmit: document.querySelector('#text-annotation-submit'),
|
||||
textAnnotationBuilder: document.querySelector("#text-annotation-builder"),
|
||||
textAnnotationOptions: document.querySelector("#text-annotation-options"),
|
||||
textAnnotationInput: document.querySelector("#text-annotation-input"),
|
||||
textAnnotationSubmit: document.querySelector("#text-annotation-submit"),
|
||||
//#endregion Structural Attributes
|
||||
|
||||
//#region Token Attributes
|
||||
tokenCounter: 0,
|
||||
|
||||
lemma: document.querySelector('#lemma'),
|
||||
emptyToken: document.querySelector('#empty-token'),
|
||||
word: document.querySelector('#word'),
|
||||
lemma: document.querySelector('#lemma'),
|
||||
pos: document.querySelector('#pos'),
|
||||
simplePosButton: document.querySelector('#simple-pos-button'),
|
||||
incidenceModifiers: document.querySelector('[data-target="incidence-modifiers"]'),
|
||||
or: document.querySelector('#or'),
|
||||
and: document.querySelector('#and'),
|
||||
lemma: document.querySelector("#lemma"),
|
||||
emptyToken: document.querySelector("#empty-token"),
|
||||
word: document.querySelector("#word"),
|
||||
lemma: document.querySelector("#lemma"),
|
||||
pos: document.querySelector("#pos"),
|
||||
simplePosButton: document.querySelector("#simple-pos-button"),
|
||||
incidenceModifiers: document.querySelector("[data-target='incidence-modifiers']"),
|
||||
or: document.querySelector("#or"),
|
||||
and: document.querySelector("#and"),
|
||||
|
||||
|
||||
//#region Word and Lemma Elements
|
||||
wordBuilder: document.querySelector('#word-builder'),
|
||||
lemmaBuilder: document.querySelector('#lemma-builder'),
|
||||
inputOptions: document.querySelector('#input-options'),
|
||||
wordInput: document.querySelector('#word-input'),
|
||||
wordSubmit: document.querySelector('#word-submit'),
|
||||
lemmaInput: document.querySelector('#lemma-input'),
|
||||
lemmaSubmit: document.querySelector('#lemma-submit'),
|
||||
ignoreCaseCheckbox : document.querySelector('#ignore-case-checkbox'),
|
||||
ignoreCase: document.querySelector('input[type="checkbox"]'),
|
||||
wildcardChar: document.querySelector('#wildcard-char'),
|
||||
optionGroup: document.querySelector('#option-group'),
|
||||
incidenceModifiersTB: document.querySelector('[data-target="incidence-modifiers-text-builder"]'),
|
||||
wordBuilder: document.querySelector("#word-builder"),
|
||||
lemmaBuilder: document.querySelector("#lemma-builder"),
|
||||
inputOptions: document.querySelector("#input-options"),
|
||||
wordInput: document.querySelector("#word-input"),
|
||||
wordSubmit: document.querySelector("#word-submit"),
|
||||
lemmaInput: document.querySelector("#lemma-input"),
|
||||
lemmaSubmit: document.querySelector("#lemma-submit"),
|
||||
ignoreCaseCheckbox : document.querySelector("#ignore-case-checkbox"),
|
||||
ignoreCase: document.querySelector("input[type='checkbox']"),
|
||||
wildcardChar: document.querySelector("#wildcard-char"),
|
||||
optionGroup: document.querySelector("#option-group"),
|
||||
incidenceModifiersTB: document.querySelector("[data-target='incidence-modifiers-text-builder']"),
|
||||
//#endregion Word and Lemma Elements
|
||||
|
||||
//#region posBuilder Elements
|
||||
posBuilder: document.querySelector('#pos-builder'),
|
||||
englishPos: document.querySelector('#english-pos'),
|
||||
germanPos: document.querySelector('#german-pos'),
|
||||
posBuilder: document.querySelector("#pos-builder"),
|
||||
englishPos: document.querySelector("#english-pos"),
|
||||
germanPos: document.querySelector("#german-pos"),
|
||||
//#endregion posBuilder Elements
|
||||
|
||||
//#region simple_posBuilder Elements
|
||||
simplePosBuilder: document.querySelector('#simplepos-builder'),
|
||||
simplePos: document.querySelector('#simple-pos'),
|
||||
simplePosBuilder: document.querySelector("#simplepos-builder"),
|
||||
simplePos: document.querySelector("#simple-pos"),
|
||||
//#endregion simple_posBuilder Elements
|
||||
|
||||
//#region incidence modifiers
|
||||
oneOrMore: document.querySelector('#one-or-more'),
|
||||
zeroOrMore: document.querySelector('#zero-or-more'),
|
||||
zeroOrOne: document.querySelector('#zero-or-one'),
|
||||
exactlyN: document.querySelector('#exactly-n'),
|
||||
betweenNM: document.querySelector('#between-n-m'),
|
||||
oneOrMore: document.querySelector("#one-or-more"),
|
||||
zeroOrMore: document.querySelector("#zero-or-more"),
|
||||
zeroOrOne: document.querySelector("#zero-or-one"),
|
||||
exactlyN: document.querySelector("#exactlyN"),
|
||||
betweenNM: document.querySelector("#betweenNM"),
|
||||
nInput: document.querySelector("#n-input"),
|
||||
nSubmit: document.querySelector("#n-submit"),
|
||||
nmInput: document.querySelector("#n-m-input"),
|
||||
mInput: document.querySelector("#m-input"),
|
||||
nmSubmit: document.querySelector("#n-m-submit"),
|
||||
|
||||
oneOrMoreTB: document.querySelector('#one-or-more-tb'),
|
||||
zeroOrMoreTB: document.querySelector('#zero-or-more-tb'),
|
||||
zeroOrOneTB: document.querySelector('#zero-or-one-tb'),
|
||||
exactlyNTB: document.querySelector('#exactly-n-tb'),
|
||||
betweenNMTB: document.querySelector('#between-n-m-tb')
|
||||
oneOrMoreTB: document.querySelector("#one-or-more-tb"),
|
||||
zeroOrMoreTB: document.querySelector("#zero-or-more-tb"),
|
||||
zeroOrOneTB: document.querySelector("#zero-or-one-tb"),
|
||||
exactlyNTB: document.querySelector("#exactly-n-tb"),
|
||||
betweenNMTB: document.querySelector("#between-n-m-tb")
|
||||
//#endregion incidence modifiers
|
||||
|
||||
//#endregion Token Attributes
|
||||
}
|
||||
|
||||
this.elements.concordanceQueryBuilderButton.addEventListener('click', () => {this.clearAll();});
|
||||
this.elements.concordanceQueryBuilderButton.addEventListener("click", () => {this.clearAll();});
|
||||
this.elements.insertQueryButton.addEventListener("click", () => {this.insertQuery();});
|
||||
|
||||
//#region Structural Attribute Event Listeners
|
||||
this.elements.sentence.addEventListener('click', () => {this.addSentence();});
|
||||
this.elements.entity.addEventListener('click', () => {this.addEntity();});
|
||||
this.elements.textAnnotation.addEventListener('click', () => {this.addTextAnnotation();});
|
||||
this.elements.sentence.addEventListener("click", () => {this.addSentence();});
|
||||
this.elements.entity.addEventListener("click", () => {this.addEntity();});
|
||||
this.elements.textAnnotation.addEventListener("click", () => {this.addTextAnnotation();});
|
||||
|
||||
this.elements.englishEntType.addEventListener('change', () => {this.englishEntTypeHandler();});
|
||||
this.elements.emptyEntity.addEventListener('click', () => {this.emptyEntityButton();});
|
||||
this.elements.englishEntType.addEventListener("change", () => {this.englishEntTypeHandler();});
|
||||
this.elements.germanEntType.addEventListener("change", () => {this.germanEntTypeHandler();});
|
||||
this.elements.emptyEntity.addEventListener("click", () => {this.emptyEntityButton();});
|
||||
|
||||
this.elements.textAnnotationSubmit.addEventListener('click', () => {this.textAnnotationSubmitHandler();});
|
||||
this.elements.textAnnotationSubmit.addEventListener("click", () => {this.textAnnotationSubmitHandler();});
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Token Attribute Event Listeners
|
||||
this.elements.buildTokenButton.addEventListener('click', () => {this.addToken();});
|
||||
this.elements.emptyToken.addEventListener('click', () => {this.emptyTokenHandler();});
|
||||
this.elements.word.addEventListener('click', () => {this.wordBuilder();});
|
||||
this.elements.lemma.addEventListener('click', () => {this.lemmaBuilder();});
|
||||
this.elements.pos.addEventListener('click', () => {this.posBuilder();});
|
||||
this.elements.simplePosButton.addEventListener('click', () => {this.simplePosBuilder();});
|
||||
this.elements.or.addEventListener('click', () => {this.orHandler();});
|
||||
this.elements.and.addEventListener('click', () => {this.andHandler();});
|
||||
this.elements.buildTokenButton.addEventListener("click", () => {this.addToken();});
|
||||
this.elements.emptyToken.addEventListener("click", () => {this.emptyTokenHandler();});
|
||||
this.elements.word.addEventListener("click", () => {this.wordBuilder();});
|
||||
this.elements.lemma.addEventListener("click", () => {this.lemmaBuilder();});
|
||||
this.elements.pos.addEventListener("click", () => {this.posBuilder();});
|
||||
this.elements.simplePosButton.addEventListener("click", () => {this.simplePosBuilder();});
|
||||
this.elements.or.addEventListener("click", () => {this.orHandler();});
|
||||
this.elements.and.addEventListener("click", () => {this.andHandler();});
|
||||
|
||||
this.elements.ignoreCase.addEventListener('change', () => {this.inputOptionHandler(this.elements.ignoreCase);});
|
||||
this.elements.wildcardChar.addEventListener('click', () => {this.inputOptionHandler(this.elements.wildcardChar);});
|
||||
this.elements.optionGroup.addEventListener('click', () => {this.inputOptionHandler(this.elements.optionGroup);});
|
||||
this.elements.wordSubmit.addEventListener('click', () => {this.textSubmit();});
|
||||
this.elements.lemmaSubmit.addEventListener('click', () => {this.textSubmit();});
|
||||
this.elements.ignoreCase.addEventListener("change", () => {this.inputOptionHandler(this.elements.ignoreCase);});
|
||||
this.elements.wildcardChar.addEventListener("click", () => {this.inputOptionHandler(this.elements.wildcardChar);});
|
||||
this.elements.optionGroup.addEventListener("click", () => {this.inputOptionHandler(this.elements.optionGroup);});
|
||||
this.elements.wordSubmit.addEventListener("click", () => {this.textSubmit();});
|
||||
this.elements.lemmaSubmit.addEventListener("click", () => {this.textSubmit();});
|
||||
|
||||
this.elements.englishPos.addEventListener('change', () => {this.englishPosHandler();});
|
||||
this.elements.germanPos.addEventListener('change', () => {this.germanPosHandler();});
|
||||
this.elements.simplePos.addEventListener('change', () => {this.simplePosHandler();});
|
||||
this.elements.englishPos.addEventListener("change", () => {this.englishPosHandler();});
|
||||
this.elements.germanPos.addEventListener("change", () => {this.germanPosHandler();});
|
||||
this.elements.simplePos.addEventListener("change", () => {this.simplePosHandler();});
|
||||
|
||||
this.elements.oneOrMore.addEventListener('click', () => {this.incidenceModifiersHandler(this.elements.oneOrMore);});
|
||||
this.elements.zeroOrMore.addEventListener('click', () => {this.incidenceModifiersHandler(this.elements.zeroOrMore);});
|
||||
this.elements.zeroOrOne.addEventListener('click', () => {this.incidenceModifiersHandler(this.elements.zeroOrOne);});
|
||||
this.elements.exactlyN.addEventListener('click', () => {this.incidenceModifiersHandler(this.elements.exactlyN);});
|
||||
this.elements.betweenNM.addEventListener('click', () => {this.incidenceModifiersHandler(this.elements.betweenNM);});
|
||||
this.elements.oneOrMore.addEventListener("click", () => {this.incidenceModifiersHandler(this.elements.oneOrMore);});
|
||||
this.elements.zeroOrMore.addEventListener("click", () => {this.incidenceModifiersHandler(this.elements.zeroOrMore);});
|
||||
this.elements.zeroOrOne.addEventListener("click", () => {this.incidenceModifiersHandler(this.elements.zeroOrOne);});
|
||||
this.elements.nSubmit.addEventListener("click", () => {this.nSubmitHandler();});
|
||||
this.elements.nmSubmit.addEventListener("click", () => {this.nmSubmitHandler();});
|
||||
|
||||
this.elements.oneOrMoreTB.addEventListener('click', () => {this.incidenceModifiersHandlerTB(this.elements.oneOrMoreTB);});
|
||||
this.elements.zeroOrMoreTB.addEventListener('click', () => {this.incidenceModifiersHandlerTB(this.elements.zeroOrMoreTB);});
|
||||
this.elements.zeroOrOneTB.addEventListener('click', () => {this.incidenceModifiersHandlerTB(this.elements.zeroOrOneTB);});
|
||||
this.elements.exactlyNTB.addEventListener('click', () => {this.incidenceModifiersHandlerTB(this.elements.exactlyNTB);});
|
||||
this.elements.betweenNMTB.addEventListener('click', () => {this.incidenceModifiersHandlerTB(this.elements.betweenNMTB);});
|
||||
this.elements.oneOrMoreTB.addEventListener("click", () => {this.incidenceModifiersHandlerTB(this.elements.oneOrMoreTB);});
|
||||
this.elements.zeroOrMoreTB.addEventListener("click", () => {this.incidenceModifiersHandlerTB(this.elements.zeroOrMoreTB);});
|
||||
this.elements.zeroOrOneTB.addEventListener("click", () => {this.incidenceModifiersHandlerTB(this.elements.zeroOrOneTB);});
|
||||
this.elements.exactlyNTB.addEventListener("click", () => {this.incidenceModifiersHandlerTB(this.elements.exactlyNTB);});
|
||||
this.elements.betweenNMTB.addEventListener("click", () => {this.incidenceModifiersHandlerTB(this.elements.betweenNMTB);});
|
||||
|
||||
|
||||
//#endregion Token Attribute Event Listeners
|
||||
@ -160,57 +170,75 @@ class ConcordanceQueryBuilder {
|
||||
//#region Structural Attribute Builder Functions
|
||||
addSentence() {
|
||||
this.hideEverything();
|
||||
if(this.elements.sentence.text === "End Sentence") {
|
||||
this.buttonfactory("end-sentence", "Sentence End");
|
||||
this.elements.sentence.innerHTML = "Sentence";
|
||||
} else {
|
||||
this.buttonfactory("start-sentence", "Sentence Start");
|
||||
this.elements.insertQueryButton.classList.remove('disabled');
|
||||
if(this.elements.sentence.text === 'End Sentence') {
|
||||
this.buttonfactory('end-sentence', 'Sentence End', '</s>');
|
||||
this.elements.sentence.innerHTML = 'Sentence';
|
||||
this.elements.insertQueryButton.classList.remove("disabled");
|
||||
this.elements.counter += 1;
|
||||
this.elements.queryContent.push('sentence');
|
||||
this.elements.sentence.innerHTML = "End Sentence";
|
||||
} else {
|
||||
this.buttonfactory('start-sentence', 'Sentence Start', '<s>');
|
||||
this.elements.queryContent.push("sentence");
|
||||
this.elements.sentence.innerHTML = 'End Sentence';
|
||||
}
|
||||
}
|
||||
|
||||
addEntity() {
|
||||
if(this.elements.entity.text === "End Entity"){
|
||||
this.buttonfactory("end-entity", "Entity End");
|
||||
this.elements.entity.innerHTML = "Entity";
|
||||
if(this.elements.entity.text === 'End Entity'){
|
||||
let queryText;
|
||||
if (this.elements.entityAnyType === false){
|
||||
queryText = '</ent_type>';
|
||||
} else {
|
||||
queryText = '</ent>';
|
||||
}
|
||||
this.buttonfactory('end-entity', 'Entity End', queryText);
|
||||
this.elements.entity.innerHTML = 'Entity';
|
||||
this.elements.insertQueryButton.classList.remove("disabled");
|
||||
this.elements.counter += 1;
|
||||
|
||||
} else {
|
||||
this.hideEverything();
|
||||
this.elements.entityBuilder.classList.remove('hide');
|
||||
this.elements.entityBuilder.classList.remove("hide");
|
||||
}
|
||||
}
|
||||
|
||||
englishEntTypeHandler() {
|
||||
|
||||
this.buttonfactory("start-entity", "Entity Type=" + this.elements.englishEntType.value);
|
||||
this.elements.insertQueryButton.classList.remove('disabled');
|
||||
this.elements.counter+=1;
|
||||
this.elements.entity.innerHTML = "End Entity";
|
||||
this.buttonfactory('start-entity', 'Entity Type=' + this.elements.englishEntType.value, '<ent_type="' + this.elements.englishEntType.value + '">');
|
||||
this.elements.entity.innerHTML = 'End Entity';
|
||||
this.hideEverything();
|
||||
this.elements.entityAnyType = false;
|
||||
|
||||
}
|
||||
|
||||
germanEntTypeHandler() {
|
||||
|
||||
this.buttonfactory('start-entity', 'Entity Type=' + this.elements.germanEntType.value, '<ent_type="' + this.elements.germanEntType.value + '">');
|
||||
this.elements.entity.innerHTML = 'End Entity';
|
||||
this.hideEverything();
|
||||
this.elements.entityAnyType = false;
|
||||
|
||||
}
|
||||
|
||||
emptyEntityButton() {
|
||||
this.buttonfactory("start-entity", "Entity Start");
|
||||
this.elements.counter+=1;
|
||||
this.elements.entity.innerHTML = "End Entity";
|
||||
this.buttonfactory('start-empty-entity', 'Entity Start', '<ent>');
|
||||
this.elements.entity.innerHTML = 'End Entity';
|
||||
this.hideEverything();
|
||||
this.elements.entityAnyType = true;
|
||||
}
|
||||
|
||||
addTextAnnotation() {
|
||||
this.hideEverything();
|
||||
this.elements.textAnnotationBuilder.classList.remove('hide');
|
||||
this.elements.textAnnotationBuilder.classList.remove("hide");
|
||||
|
||||
}
|
||||
|
||||
textAnnotationSubmitHandler() {
|
||||
this.buttonfactory("tA" + this.elements.textAnnotationOptions.value, this.elements.textAnnotationOptions.value + "= " + this.elements.textAnnotationInput.value)
|
||||
let queryText = ':: match.text_' + this.elements.textAnnotationOptions.value + '="' + this.elements.textAnnotationInput.value + '"';
|
||||
this.buttonfactory('text-annotation', this.elements.textAnnotationOptions.value + '= ' + this.elements.textAnnotationInput.value, queryText);
|
||||
this.elements.insertQueryButton.classList.remove("disabled");
|
||||
this.elements.counter+=1;
|
||||
this.hideEverything();
|
||||
this.elements.textAnnotationInput.value = "";
|
||||
this.elements.textAnnotationInput.value = '';
|
||||
}
|
||||
|
||||
|
||||
@ -219,240 +247,255 @@ class ConcordanceQueryBuilder {
|
||||
//#region Token Attribute Builder Functions
|
||||
emptyTokenHandler() {
|
||||
this.hideEverything();
|
||||
this.elements.incidenceModifiers.classList.remove("hide");
|
||||
this.tokenButtonfactory("emptyToken", "empty token");
|
||||
this.buttonDisabler("empty");
|
||||
this.elements.buildTokenButton.classList.remove('disabled');
|
||||
this.elements.incidenceModifiers.classList.remove('hide');
|
||||
this.tokenButtonfactory('emptyToken', 'empty token', '[]');
|
||||
this.buttonDisabler('empty');
|
||||
this.elements.buildTokenButton.classList.remove("disabled");
|
||||
this.elements.tokenCounter+=1;
|
||||
}
|
||||
|
||||
wordBuilder() {
|
||||
this.elements.incidenceModifiers.classList.add("hide");
|
||||
this.elements.incidenceModifiers.classList.add('hide');
|
||||
this.hideEverything();
|
||||
this.elements.wordBuilder.classList.remove('hide');
|
||||
this.elements.inputOptions.classList.remove('hide');
|
||||
this.elements.ignoreCaseCheckbox.classList.remove('hide');
|
||||
this.elements.wordBuilder.classList.remove("hide");
|
||||
this.elements.inputOptions.classList.remove("hide");
|
||||
this.elements.ignoreCaseCheckbox.classList.remove("hide");
|
||||
this.elements.incidenceModifiersTB.classList.remove('disabled');
|
||||
}
|
||||
|
||||
lemmaBuilder() {
|
||||
this.elements.incidenceModifiers.classList.add("hide");
|
||||
this.elements.incidenceModifiers.classList.add('hide');
|
||||
this.hideEverything();
|
||||
this.elements.lemmaBuilder.classList.remove('hide');
|
||||
this.elements.inputOptions.classList.remove('hide');
|
||||
this.elements.ignoreCaseCheckbox.classList.remove('hide');
|
||||
this.elements.lemmaBuilder.classList.remove("hide");
|
||||
this.elements.inputOptions.classList.remove("hide");
|
||||
this.elements.ignoreCaseCheckbox.classList.remove("hide");
|
||||
this.elements.incidenceModifiersTB.classList.remove('disabled');
|
||||
}
|
||||
|
||||
inputOptionHandler(elem) {
|
||||
let input;
|
||||
|
||||
if (this.elements.wordBuilder.classList.contains("hide") === false){
|
||||
if (this.elements.wordBuilder.classList.contains('hide') === false){
|
||||
input = this.elements.wordInput;
|
||||
}else{
|
||||
input = this.elements.lemmaInput;
|
||||
}
|
||||
|
||||
if (elem === this.elements.optionGroup) {
|
||||
input.value += "( option1 | option2 )";
|
||||
let firstIndex = input.value.indexOf("option1");
|
||||
let lastIndex = firstIndex + "option1".length;
|
||||
input.value += '( option1 | option2 )';
|
||||
let firstIndex = input.value.indexOf('option1');
|
||||
let lastIndex = firstIndex + 'option1'.length;
|
||||
input.focus();
|
||||
input.setSelectionRange(firstIndex, lastIndex);
|
||||
}else if (elem === this.elements.wildcardChar){
|
||||
input.value += ".";
|
||||
input.value += '.';
|
||||
}
|
||||
}
|
||||
|
||||
textSubmit() {
|
||||
this.buttonDisabler();
|
||||
this.elements.incidenceModifiers.classList.remove('disabled');
|
||||
this.elements.incidenceModifiers.classList.remove("disabled");
|
||||
let c;
|
||||
|
||||
if (this.elements.ignoreCase.checked){
|
||||
c = "%c";
|
||||
c = ' %c';
|
||||
}else{
|
||||
c = "";
|
||||
c = '';
|
||||
}
|
||||
|
||||
if (this.elements.wordBuilder.classList.contains("hide") === false){
|
||||
this.tokenButtonfactory("word", "word=" + this.elements.wordInput.value + c);
|
||||
this.elements.buildTokenButton.classList.remove('disabled');
|
||||
if (this.elements.wordBuilder.classList.contains('hide') === false){
|
||||
this.tokenButtonfactory('word', 'word=' + this.elements.wordInput.value + c, 'word="'+ this.elements.wordInput.value + '"' + c );
|
||||
this.elements.buildTokenButton.classList.remove("disabled");
|
||||
this.elements.tokenCounter+=1;
|
||||
this.elements.wordInput.value = "";
|
||||
}else if (this.elements.lemmaBuilder.classList.contains("hide") === false){
|
||||
this.tokenButtonfactory("lemma", "lemma=" + this.elements.lemmaInput.value + c);
|
||||
this.elements.buildTokenButton.classList.remove('disabled');
|
||||
this.elements.wordInput.value = '';
|
||||
}else if (this.elements.lemmaBuilder.classList.contains('hide') === false){
|
||||
this.tokenButtonfactory('lemma', 'lemma=' + this.elements.lemmaInput.value + c, 'lemma="'+ this.elements.lemmaInput.value + '"' + c);
|
||||
this.elements.buildTokenButton.classList.remove("disabled");
|
||||
this.elements.tokenCounter+=1;
|
||||
this.elements.lemmaInput.value = "";
|
||||
this.elements.lemmaInput.value = '';
|
||||
}
|
||||
}
|
||||
|
||||
posBuilder() {
|
||||
this.hideEverything();
|
||||
this.elements.incidenceModifiers.classList.remove("hide");
|
||||
this.elements.incidenceModifiers.classList.remove('hide');
|
||||
this.elements.positionalAttr.appendChild(this.elements.incidenceModifiers);
|
||||
this.elements.posBuilder.classList.remove('hide');
|
||||
this.elements.posBuilder.classList.remove("hide");
|
||||
}
|
||||
|
||||
englishPosHandler() {
|
||||
this.buttonDisabler();
|
||||
this.tokenButtonfactory("pos", "pos=" + this.elements.englishPos.value);
|
||||
this.elements.buildTokenButton.classList.remove('disabled');
|
||||
this.tokenButtonfactory('pos', 'pos=' + this.elements.englishPos.value, 'pos="' + this.elements.englishPos.value + '"');
|
||||
this.elements.buildTokenButton.classList.remove("disabled");
|
||||
this.elements.tokenCounter+=1;
|
||||
}
|
||||
|
||||
germanPosHandler() {
|
||||
this.buttonDisabler();
|
||||
this.tokenButtonfactory("pos", "pos=" + this.elements.germanPos.value);
|
||||
this.elements.buildTokenButton.classList.remove('disabled');
|
||||
this.tokenButtonfactory('pos', 'pos=' + this.elements.germanPos.value, 'pos="' + this.elements.germanPos.value + '"');
|
||||
this.elements.buildTokenButton.classList.remove("disabled");
|
||||
this.elements.tokenCounter+=1;
|
||||
}
|
||||
|
||||
simplePosBuilder() {
|
||||
this.hideEverything();
|
||||
this.elements.incidenceModifiers.classList.remove("hide");
|
||||
this.elements.incidenceModifiers.classList.remove('hide');
|
||||
this.elements.positionalAttr.appendChild(this.elements.incidenceModifiers);
|
||||
this.elements.simplePosBuilder.classList.remove('hide');
|
||||
this.elements.simplePosBuilder.classList.remove("hide");
|
||||
}
|
||||
|
||||
simplePosHandler() {
|
||||
this.buttonDisabler();
|
||||
this.tokenButtonfactory("simplePos", "simple_pos=" + this.elements.simplePos.value);
|
||||
this.elements.buildTokenButton.classList.remove('disabled');
|
||||
this.tokenButtonfactory('simplePos', 'simple_pos=' + this.elements.simplePos.value, 'simple_pos="' + this.elements.simplePos.value + '"');
|
||||
this.elements.buildTokenButton.classList.remove("disabled");
|
||||
this.elements.tokenCounter+=1;
|
||||
}
|
||||
|
||||
incidenceModifiersHandler(input) {
|
||||
if (input.id === "exactly-n"){
|
||||
|
||||
} else if (input.id === "between-n-m"){
|
||||
|
||||
} else {
|
||||
this.tokenButtonfactory("incidenceModifier", input.text);
|
||||
}
|
||||
this.elements.incidenceModifiers.classList.add('disabled');
|
||||
this.elements.tokenCounter+=1;
|
||||
this.tokenButtonfactory('incidenceModifier', input.text, input.dataset.token);
|
||||
this.elements.incidenceModifiers.classList.add("disabled");
|
||||
this.elements.tokenCounter+=1;
|
||||
}
|
||||
|
||||
nSubmitHandler() {
|
||||
this.tokenButtonfactory('exactlyN', 'Exactly ' + this.elements.nInput.value, '{' + this.elements.nInput.value + '}');
|
||||
let instance = M.Modal.getInstance(this.elements.exactlyN);
|
||||
instance.close();
|
||||
this.elements.incidenceModifiers.classList.add('disabled');
|
||||
|
||||
}
|
||||
|
||||
nmSubmitHandler() {
|
||||
this.tokenButtonfactory('betweenNM', 'Between ' + this.elements.nmInput.value + ' and ' + this.elements.mInput.value, '{' + this.elements.nmInput.value + ',' + this.elements.mInput.value + '}');
|
||||
let instance = M.Modal.getInstance(this.elements.betweenNM);
|
||||
instance.close();
|
||||
this.elements.incidenceModifiers.classList.add('disabled');
|
||||
}
|
||||
|
||||
// TB = Text Builder
|
||||
incidenceModifiersHandlerTB(elem) {
|
||||
let input;
|
||||
|
||||
if (this.elements.wordBuilder.classList.contains("hide") === false){
|
||||
if (this.elements.wordBuilder.classList.contains('hide') === false){
|
||||
input = this.elements.wordInput;
|
||||
}else{
|
||||
input = this.elements.lemmaInput;
|
||||
}
|
||||
|
||||
if (elem.id === "exactly-n-tb"){
|
||||
if (elem.id === 'exactly-n-tb'){
|
||||
input.value += elem.dataset.token;
|
||||
let index = input.value.lastIndexOf("{n}");
|
||||
let index = input.value.lastIndexOf('{n}');
|
||||
let instance = M.Dropdown.getInstance(this.elements.incidenceModifiersTB);
|
||||
instance.close();
|
||||
input.focus();
|
||||
input.setSelectionRange(index+1, index+2);
|
||||
}else if (elem.id === "between-n-m-tb") {
|
||||
input.value += input.dataset.token;
|
||||
let index = input.value.lastIndexOf("{n,m}");
|
||||
}else if (elem.id === 'between-n-m-tb') {
|
||||
input.value += elem.dataset.token;
|
||||
let index = input.value.lastIndexOf('{n,m}');
|
||||
let instance = M.Dropdown.getInstance(this.elements.incidenceModifiersTB);
|
||||
instance.close();
|
||||
input.focus();
|
||||
input.setSelectionRange(index+1, index+2);
|
||||
}else {
|
||||
input.value += " " + elem.dataset.token;
|
||||
input.value += ' ' + elem.dataset.token;
|
||||
}
|
||||
|
||||
this.elements.incidenceModifiersTB.classList.add('disabled');
|
||||
}
|
||||
|
||||
orHandler() {
|
||||
this.elements.positionalAttr.appendChild(this.elements.incidenceModifiers);
|
||||
this.buttonDisabler("condition");
|
||||
this.buttonDisabler('condition');
|
||||
this.hideEverything();
|
||||
this.tokenButtonfactory("or", "or");
|
||||
this.elements.buildTokenButton.classList.remove('disabled');
|
||||
this.tokenButtonfactory('or', 'or', '|');
|
||||
this.elements.buildTokenButton.classList.remove("disabled");
|
||||
this.elements.tokenCounter+=1;
|
||||
}
|
||||
|
||||
andHandler() {
|
||||
this.elements.positionalAttr.appendChild(this.elements.incidenceModifiers);
|
||||
this.buttonDisabler("condition");
|
||||
this.buttonDisabler('condition');
|
||||
this.hideEverything();
|
||||
this.tokenButtonfactory("and", "and");
|
||||
this.elements.buildTokenButton.classList.remove('disabled');
|
||||
this.tokenButtonfactory('and', 'and', '&');
|
||||
this.elements.buildTokenButton.classList.remove("disabled");
|
||||
this.elements.tokenCounter+=1;
|
||||
}
|
||||
|
||||
hideEverything(){
|
||||
|
||||
this.elements.wordBuilder.classList.add('hide');
|
||||
this.elements.lemmaBuilder.classList.add('hide');
|
||||
this.elements.ignoreCaseCheckbox.classList.add('hide');
|
||||
this.elements.inputOptions.classList.add('hide');
|
||||
this.elements.posBuilder.classList.add('hide');
|
||||
this.elements.simplePosBuilder.classList.add('hide');
|
||||
this.elements.entityBuilder.classList.add('hide');
|
||||
this.elements.textAnnotationBuilder.classList.add('hide');
|
||||
this.elements.wordBuilder.classList.add("hide");
|
||||
this.elements.lemmaBuilder.classList.add("hide");
|
||||
this.elements.ignoreCaseCheckbox.classList.add("hide");
|
||||
this.elements.inputOptions.classList.add("hide");
|
||||
this.elements.posBuilder.classList.add("hide");
|
||||
this.elements.simplePosBuilder.classList.add("hide");
|
||||
this.elements.entityBuilder.classList.add("hide");
|
||||
this.elements.textAnnotationBuilder.classList.add("hide");
|
||||
}
|
||||
|
||||
buttonDisabler(attr = "token") {
|
||||
let tokenButtonList = this.elements.positionalAttr.querySelectorAll('a');
|
||||
if (attr === "start"){
|
||||
buttonDisabler(attr = 'token') {
|
||||
let tokenButtonList = this.elements.positionalAttr.querySelectorAll("a");
|
||||
if (attr === 'start'){
|
||||
tokenButtonList.forEach(element => {
|
||||
if (element.id === "or"){
|
||||
element.classList.add('disabled');
|
||||
} else if (element.id === "and"){
|
||||
element.classList.add('disabled');
|
||||
}else if (element.dataset.target == "incidence-modifiers") {
|
||||
element.classList.add('disabled');
|
||||
} else if (element.id === "empty-token"){
|
||||
element.classList.remove('disabled');
|
||||
if (element.id === 'or'){
|
||||
element.classList.add("disabled");
|
||||
} else if (element.id === 'and'){
|
||||
element.classList.add("disabled");
|
||||
}else if (element.dataset.target == 'incidence-modifiers') {
|
||||
element.classList.add("disabled");
|
||||
} else if (element.id === 'empty-token'){
|
||||
element.classList.remove("disabled");
|
||||
} else {
|
||||
element.classList.remove('disabled');
|
||||
element.classList.remove("disabled");
|
||||
}
|
||||
});
|
||||
}else if (attr === "condition"){
|
||||
}else if (attr === 'condition'){
|
||||
tokenButtonList.forEach(element => {
|
||||
if (element.id === "or"){
|
||||
element.classList.add('disabled');
|
||||
} else if (element.id === "and"){
|
||||
element.classList.add('disabled');
|
||||
}else if (element.dataset.target == "incidence-modifiers") {
|
||||
element.classList.add('disabled');
|
||||
} else if (element.id === "empty-token"){
|
||||
element.classList.add('disabled');
|
||||
if (element.id === 'or'){
|
||||
element.classList.add("disabled");
|
||||
} else if (element.id === 'and'){
|
||||
element.classList.add("disabled");
|
||||
}else if (element.dataset.target == 'incidence-modifiers') {
|
||||
element.classList.add("disabled");
|
||||
} else if (element.id === 'empty-token'){
|
||||
element.classList.add("disabled");
|
||||
} else {
|
||||
element.classList.remove('disabled');
|
||||
element.classList.remove("disabled");
|
||||
}
|
||||
});
|
||||
}else if (attr === "empty") {
|
||||
}else if (attr === 'empty') {
|
||||
tokenButtonList.forEach(element => {
|
||||
if (element.id == "or"){
|
||||
element.classList.add('disabled');
|
||||
} else if (element.id == "and"){
|
||||
element.classList.add('disabled');
|
||||
}else if (element.dataset.target == "incidence-modifiers") {
|
||||
element.classList.remove('disabled');
|
||||
if (element.id == 'or'){
|
||||
element.classList.add("disabled");
|
||||
} else if (element.id == 'and'){
|
||||
element.classList.add("disabled");
|
||||
}else if (element.dataset.target == 'incidence-modifiers') {
|
||||
element.classList.remove("disabled");
|
||||
} else {
|
||||
element.classList.add('disabled');
|
||||
element.classList.add("disabled");
|
||||
}
|
||||
});
|
||||
}else{
|
||||
tokenButtonList.forEach(element => {
|
||||
if (element.id == "or"){
|
||||
element.classList.remove('disabled');
|
||||
} else if (element.id == "and"){
|
||||
element.classList.remove('disabled');
|
||||
}else if (element.dataset.target == "incidence-modifiers") {
|
||||
element.classList.remove('disabled');
|
||||
if (element.id == 'or'){
|
||||
element.classList.remove("disabled");
|
||||
} else if (element.id == 'and'){
|
||||
element.classList.remove("disabled");
|
||||
}else if (element.dataset.target == 'incidence-modifiers') {
|
||||
element.classList.remove("disabled");
|
||||
} else {
|
||||
element.classList.add('disabled');
|
||||
element.classList.add("disabled");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
tokenButtonfactory(dataType, prettyText) {
|
||||
this.elements.buttonPreparer.innerHTML += "<a class='btn-small waves-effect waves-light' style='margin-left:3px' data-type='" + dataType + "'>" + prettyText + "</a>";
|
||||
let tokenDummyButton = this.elements.buttonPreparer.querySelector(":first-child");
|
||||
tokenDummyButton.addEventListener('click', () => {this.deleteTokenAttr(tokenDummyButton);});
|
||||
tokenButtonfactory(dataType, prettyText, tokenText) {
|
||||
tokenText = encodeURI(tokenText);
|
||||
this.elements.buttonPreparer.innerHTML += '<a class="btn-small waves-effect waves-light" style="margin-left:3px" data-type="' + dataType + '" data-tokentext="' + tokenText + '">' + prettyText + '</a>';
|
||||
let tokenDummyButton = this.elements.buttonPreparer.querySelector(':first-child');
|
||||
tokenDummyButton.addEventListener("click", () => {this.deleteTokenAttr(tokenDummyButton);});
|
||||
this.elements.tokenQuery.appendChild(tokenDummyButton);
|
||||
}
|
||||
|
||||
@ -467,12 +510,12 @@ class ConcordanceQueryBuilder {
|
||||
}
|
||||
|
||||
if(indexOfAttr>0){
|
||||
if (attr.dataset.type === "or" || attr.dataset.type === "and") {
|
||||
if (attr.dataset.type === 'or' || attr.dataset.type === 'and') {
|
||||
this.elements.tokenQuery.removeChild(nodesList[indexOfAttr+1]);
|
||||
this.elements.tokenCounter-=1;
|
||||
|
||||
}else {
|
||||
if (nodesList[indexOfAttr-1].dataset.type === "or" || nodesList[indexOfAttr-1].dataset.type === "and"){
|
||||
if (nodesList[indexOfAttr-1].dataset.type === 'or' || nodesList[indexOfAttr-1].dataset.type === 'and'){
|
||||
this.elements.tokenQuery.removeChild(nodesList[indexOfAttr-1])
|
||||
this.elements.tokenCounter-=1;
|
||||
}
|
||||
@ -483,34 +526,49 @@ class ConcordanceQueryBuilder {
|
||||
this.elements.tokenCounter-=1;
|
||||
|
||||
if(this.elements.tokenCounter === 0){
|
||||
this.elements.buildTokenButton.classList.add('disabled');
|
||||
this.buttonDisabler("start");
|
||||
this.elements.buildTokenButton.classList.add("disabled");
|
||||
this.buttonDisabler('start');
|
||||
this.hideEverything();
|
||||
}
|
||||
}
|
||||
|
||||
addToken() {
|
||||
let tokenQueryContent = "";
|
||||
this.elements.tokenQuery.childNodes.forEach(element => {
|
||||
tokenQueryContent += " " + element.text + " "
|
||||
});
|
||||
this.buttonfactory("token", tokenQueryContent);
|
||||
tokenQueryContent = "";
|
||||
this.elements.tokenQuery.innerHTML = "";
|
||||
let tokenQueryContent = '';
|
||||
let tokenQueryText = '';
|
||||
let emptyTokenCheck = false;
|
||||
|
||||
for (let element of this.elements.tokenQuery.childNodes) {
|
||||
tokenQueryContent += ' ' + element.text + ' ';
|
||||
tokenQueryText += ' ' + decodeURI(element.dataset.tokentext);
|
||||
if (element.dataset.type === "emptyToken"){
|
||||
emptyTokenCheck = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (emptyTokenCheck === false){
|
||||
tokenQueryText = '[' + tokenQueryText + ']';
|
||||
}
|
||||
|
||||
this.buttonfactory('token', tokenQueryContent, tokenQueryText);
|
||||
tokenQueryContent = '';
|
||||
this.elements.tokenQuery.innerHTML = '';
|
||||
this.elements.tokenCounter = 0;
|
||||
this.elements.buildTokenButton.classList.add('disabled');
|
||||
this.elements.buildTokenButton.classList.add("disabled");
|
||||
this.hideEverything();
|
||||
this.buttonDisabler("start")
|
||||
this.buttonDisabler('start');
|
||||
this.elements.insertQueryButton.classList.remove("disabled");
|
||||
this.elements.counter += 1;
|
||||
}
|
||||
|
||||
//#endregion Token Attribute Builder Functions
|
||||
|
||||
//#region General Functions
|
||||
|
||||
buttonfactory(dataType, prettyText) {
|
||||
this.elements.buttonPreparer.innerHTML += "<a class='btn-small waves-effect waves-light' style='margin-left:3px' data-type='" + dataType + "'>" + prettyText + "</a>";
|
||||
let dummyButton = this.elements.buttonPreparer.querySelector(":first-child");
|
||||
dummyButton.addEventListener('click', () => {this.deleteAttr(dummyButton);});
|
||||
buttonfactory(dataType, prettyText, queryText) {
|
||||
queryText = encodeURI(queryText);
|
||||
this.elements.buttonPreparer.innerHTML += '<a class="btn-small waves-effect waves-light" style="margin-left:3px" data-type="' + dataType + '" data-query="' + queryText + '">' + prettyText + '</a>';
|
||||
let dummyButton = this.elements.buttonPreparer.querySelector(':first-child');
|
||||
dummyButton.addEventListener("click", () => {this.deleteAttr(dummyButton);});
|
||||
this.elements.yourQuery.appendChild(dummyButton);
|
||||
}
|
||||
|
||||
@ -521,88 +579,96 @@ class ConcordanceQueryBuilder {
|
||||
let indexOfAttr;
|
||||
let connectedElement;
|
||||
|
||||
// Why nodesList.indexOf(attr) doesn't work?!
|
||||
// Why nodesList.indexOf(attr) doesn"t work?!
|
||||
for (let i = 0; i < nodesList.length; i++) {
|
||||
if(nodesList[i] === attr){
|
||||
indexOfAttr = i;
|
||||
}
|
||||
}
|
||||
|
||||
switch (attr.dataset.type) {
|
||||
case "start-sentence":
|
||||
case 'start-sentence':
|
||||
for (let i = indexOfAttr; i < nodesList.length; i++) {
|
||||
if (nodesList[i].dataset.type === "end-sentence"){
|
||||
if (nodesList[i].dataset.type === 'end-sentence'){
|
||||
siblingList.push(nodesList[i]);
|
||||
}
|
||||
}
|
||||
connectedElement = siblingList[0];
|
||||
if (connectedElement === undefined){
|
||||
this.elements.sentence.innerHTML = 'Sentence';
|
||||
}
|
||||
break;
|
||||
case "end-sentence":
|
||||
case 'end-sentence':
|
||||
for (let i = 0; i < indexOfAttr; i++) {
|
||||
if (nodesList[i].dataset.type === "start-sentence"){
|
||||
if (nodesList[i].dataset.type === 'start-sentence'){
|
||||
siblingList.push(nodesList[i]);
|
||||
}
|
||||
}
|
||||
connectedElement = siblingList[siblingList.length -1];
|
||||
break;
|
||||
case "start-entity":
|
||||
case 'start-entity':
|
||||
for (let i = indexOfAttr; i < nodesList.length; i++) {
|
||||
if (nodesList[i].dataset.type === "end-entity"){
|
||||
if (nodesList[i].dataset.type === 'end-entity'){
|
||||
siblingList.push(nodesList[i]);
|
||||
}
|
||||
}
|
||||
connectedElement = siblingList[0];
|
||||
if (connectedElement === undefined){
|
||||
this.elements.entity.innerHTML = 'Entity';
|
||||
}
|
||||
break;
|
||||
case "end-entity":
|
||||
case 'end-entity':
|
||||
for (let i = 0; i < indexOfAttr; i++) {
|
||||
if (nodesList[i].dataset.type === "start-entity"){
|
||||
if (nodesList[i].dataset.type === 'start-entity'){
|
||||
siblingList.push(nodesList[i]);
|
||||
}
|
||||
}
|
||||
connectedElement = siblingList[siblingList.length -1];
|
||||
break;
|
||||
default:
|
||||
connectedElement = "";
|
||||
connectedElement = undefined;
|
||||
break;
|
||||
}
|
||||
|
||||
if (connectedElement !== ""){
|
||||
if (connectedElement !== undefined ){
|
||||
this.elements.yourQuery.removeChild(connectedElement);
|
||||
}
|
||||
|
||||
this.elements.yourQuery.removeChild(attr);
|
||||
|
||||
this.elements.counter -= 1;
|
||||
if(this.elements.counter === 0){
|
||||
this.elements.insertQueryButton.classList.add('disabled');
|
||||
this.elements.insertQueryButton.classList.add("disabled");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
insertQuery() {
|
||||
this.elements.yourQueryContent = [];
|
||||
|
||||
for (let element of this.elements.yourQuery.childNodes) {
|
||||
let queryElement = decodeURI(element.dataset.query);
|
||||
this.elements.yourQueryContent.push(queryElement);
|
||||
}
|
||||
|
||||
let queryString = this.elements.yourQueryContent.join(' ');
|
||||
queryString += ";";
|
||||
|
||||
this.elements.concordanceQueryBuilder.classList.add('modal-close');
|
||||
this.elements.extFormQuery.value = queryString;
|
||||
|
||||
// this.elements.tokenQuery.childNodes.forEach(element => {
|
||||
// this.elements.tokenQueryContent.push([element.dataset.type, element.text]);
|
||||
// });
|
||||
// for (let key in this.positionalAttrList) {
|
||||
// if (this.positionalAttrList.hasOwnProperty(key)){
|
||||
// for (let i = 0; i < this.elements.tokenQueryContent.length; i++) {
|
||||
// if(key === this.elements.tokenQueryContent[i][0]){
|
||||
// console.log(this.positionalAttrList[key]['prettyText']);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
clearAll() {
|
||||
this.elements.tokenQuery.innerHTML = "";
|
||||
this.elements.tokenQuery.innerHTML = '';
|
||||
this.elements.tokenCounter = 0;
|
||||
this.elements.counter = 0;
|
||||
this.elements.buildTokenButton.classList.add('disabled');
|
||||
this.elements.insertQueryButton.classList.add('disabled');
|
||||
this.elements.buildTokenButton.classList.add("disabled");
|
||||
this.elements.insertQueryButton.classList.add("disabled");
|
||||
this.elements.concordanceQueryBuilder.classList.remove('modal-close');
|
||||
this.hideEverything();
|
||||
this.buttonDisabler("start");
|
||||
this.elements.yourQuery.innerHTML = "";
|
||||
this.buttonDisabler('start');
|
||||
this.elements.yourQuery.innerHTML = '';
|
||||
}
|
||||
//#endregion General Functions
|
||||
}
|
||||
|
@ -268,18 +268,43 @@
|
||||
<p></p>
|
||||
<br>
|
||||
<div class="row">
|
||||
<a class="btn waves-effect waves-light col s3 l2" id="empty-entity">Add Entity of any type</a>
|
||||
<a class="btn waves-effect waves-light col s4" id="empty-entity">Add Entity of any type</a>
|
||||
<p class="col s1 l1"></p>
|
||||
<div class= "input-field col s4 l3">
|
||||
<div class= "input-field col s3">
|
||||
<select name="englishenttype" id="english-ent-type">
|
||||
<option value="" disabled selected>English ent_type</option>
|
||||
<option value="CARDINAL">CARDINAL</option>
|
||||
<option value="DATE">DATE</option>
|
||||
<option value="EVENT">EVENT</option>
|
||||
<option value="FAC">FAC</option>
|
||||
<option value="GPE">GPE</option>
|
||||
<option value="LANGUAGE">LANGUAGE</option>
|
||||
<option value="LAW">LAW</option>
|
||||
<option value="LOC">LOC</option>
|
||||
<option value="MONEY">MONEY</option>
|
||||
<option value="NORP">NORP</option>
|
||||
<option value="ORDINAL">ORDINAL</option>
|
||||
<option value="ORG">ORG</option>
|
||||
<option value="PERCENT">PERCENT</option>
|
||||
<option value="PERSON">PERSON</option>
|
||||
<option value="PRODUCT">PRODUCT</option>
|
||||
<option value="QUANTITY">QUANTITY</option>
|
||||
<option value="TIME">TIME</option>
|
||||
<option value="WORK_OF_ART">WORK_OF_ART</option>
|
||||
</select>
|
||||
<label>Entity Type</label>
|
||||
</div>
|
||||
<div class= "input-field col s3">
|
||||
<select name="germanenttype" id="german-ent-type">
|
||||
<option value="" disabled selected>German ent_type</option>
|
||||
<option value="LOC">LOC</option>
|
||||
<option value="MISC">MISC</option>
|
||||
<option value="ORG">ORG</option>
|
||||
<option value="PER">PER</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div data-inga=""></div>
|
||||
</div>
|
||||
|
||||
|
||||
@ -298,7 +323,7 @@
|
||||
<option class="btn-small waves-effect waves-light" value="journal">journal</option>
|
||||
<option class="btn-small waves-effect waves-light" value="pages">pages</option>
|
||||
<option class="btn-small waves-effect waves-light" value="publisher">publisher</option>
|
||||
<option class="btn-small waves-effect waves-light" value="publishing year">publishing year</option>
|
||||
<option class="btn-small waves-effect waves-light" value="publishing_year">publishing year</option>
|
||||
<option class="btn-small waves-effect waves-light" value="school">school</option>
|
||||
<option class="btn-small waves-effect waves-light" value="title">title</option>
|
||||
</select>
|
||||
@ -318,8 +343,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{# #region test #}
|
||||
|
||||
<div id="positional-attr">
|
||||
<p></p>
|
||||
<div class="row">
|
||||
@ -335,7 +358,6 @@
|
||||
</div>
|
||||
</div>
|
||||
<div id="token-builder-content">
|
||||
{# #endregion test #}
|
||||
|
||||
|
||||
<div class="row">
|
||||
@ -399,6 +421,15 @@
|
||||
<option value="ADD">email</option>
|
||||
<option value="AFX">affix</option>
|
||||
<option value="CC">conjunction, coordinating</option>
|
||||
<option value="CD">cardinal number</option>
|
||||
<option value="DT">determiner</option>
|
||||
<option value="EX">existential there</option>
|
||||
<option value="FW">foreign word</option>
|
||||
<option value="HYPH">punctuation mark, hyphen</option>
|
||||
<option value="IN">conjunction, subordinating or preposition</option>
|
||||
<option value="JJ">adjective</option>
|
||||
<option value="JJR">adjective, comparative</option>
|
||||
<option value="JJS">adjective, superlative</option>
|
||||
</select>
|
||||
<label>Part-of-speech tags</label>
|
||||
</div>
|
||||
@ -408,6 +439,11 @@
|
||||
<option value="ADJA">adjective, attributive</option>
|
||||
<option value="ADJD">adjective, adverbial or predicative</option>
|
||||
<option value="ADV">adverb</option>
|
||||
<option value="APPO">postposition</option>
|
||||
<option value="APPR">preposition; circumposition left</option>
|
||||
<option value="APPRART">preposition with article</option>
|
||||
<option value="APZR">circumposition right</option>
|
||||
<option value="ART">definite or indefinite article</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@ -423,6 +459,20 @@
|
||||
<option value="ADJ">adjective</option>
|
||||
<option value="ADP">adposition</option>
|
||||
<option value="ADV">adverb</option>
|
||||
<option value="AUX">auxiliary verb</option>
|
||||
<option value="CONJ">coordinating conjunction</option>
|
||||
<option value="DET">determiner</option>
|
||||
<option value="INTJ">interjection</option>
|
||||
<option value="NOUN">noun</option>
|
||||
<option value="NUM">numeral</option>
|
||||
<option value="PART">particle</option>
|
||||
<option value="PRON">pronoun</option>
|
||||
<option value="PROPN">proper noun</option>
|
||||
<option value="PUNCT">punctuation</option>
|
||||
<option value="SCONJ">subordinating conjunction</option>
|
||||
<option value="SYM">symbol</option>
|
||||
<option value="VERB">verb</option>
|
||||
<option value="X">other</option>
|
||||
</select>
|
||||
<label>Simple part-of-speech tags</label>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user