+ `
+ );
+ buttonElement.addEventListener('click', () => {this.deleteAttr(buttonElement);});
// Ensures that metadata is always at the end of the query:
- if(this.elements.yourQuery.lastChild === null || this.elements.yourQuery.lastChild.dataset.type !== "text-annotation"){
+ if (this.elements.yourQuery.lastChild === null || this.elements.yourQuery.lastChild.dataset.type !== 'text-annotation') {
this.elements.yourQuery.appendChild(buttonElement);
- }else if (this.elements.yourQuery.lastChild.dataset.type === "text-annotation"){
+ } else if (this.elements.yourQuery.lastChild.dataset.type === 'text-annotation') {
this.elements.yourQuery.insertBefore(buttonElement, this.elements.yourQuery.lastChild);
}
-
- this.elements.queryContainer.classList.remove("hide");
+ this.elements.queryContainer.classList.remove('hide');
this.queryPreviewBuilder();
- // Opens a hint about the possible functions for editing the query when the first chip is added. It is displayed for 5 seconds and then deleted.
- if (this.elements.yourQuery.classList.contains("tooltipped")){
- let tooltipInstance = M.Tooltip.getInstance(this.elements.yourQuery);
- tooltipInstance.tooltipEl.style.background = "#98ACD2";
- tooltipInstance.tooltipEl.style.borderTop = "solid 4px #0064A3"
- tooltipInstance.tooltipEl.style.padding = "10px";
- tooltipInstance.tooltipEl.style.color = "black";
-
- if (tooltipInstance !== undefined){
- setTimeout(() => {
- tooltipInstance.open();
- setTimeout(() => {
- tooltipInstance.destroy();
- }, 5000);
- }, 500);
- }
- this.elements.yourQuery.classList.remove("tooltipped");
+ // Shows a hint about possible functions for editing the query at the first added element in the query
+ if (this.elements.yourQuery.childNodes.length === 1) {
+ app.flash('You can edit your query by deleting individual elements or moving them via drag and drop.');
}
}
- //#region Drag&Drop Events
- dragStartHandler(event){
+ //#region Drag&Drop Events
+ dragStartHandler(event) {
+ // Creates element with the class 'target' and all necessary drop functions, in which drop content can be released
this.elements.dropButton = event.target;
let targetChip = `
-
- Drop here
-
+
+ Drop here
+
`.trim();
- let childNodes = this.elements.yourQuery.querySelectorAll("div:not(.target)");
+ // selects all nodes without target class
+ let childNodes = this.elements.yourQuery.querySelectorAll('div:not(.target)');
+ // Adds a target chip in front of all draggable childnodes
setTimeout(() => {
- for (let element of childNodes){
- if(element === event.target){
+ for (let element of childNodes) {
+ if (element === this.elements.dropButton) {
+ // If the dragged element is not at the very end, a target chip is also inserted at the end
+ if (childNodes[childNodes.length - 1] !== element) {
+ childNodes[childNodes.length - 1].insertAdjacentHTML('afterend', targetChip);
+ }
+ } else if (element === this.elements.dropButton.nextSibling) {
continue;
- }else if (element === event.target.nextSibling){
- continue;
- }else {
- element.insertAdjacentHTML("beforebegin", targetChip)
+ } else {
+ element.insertAdjacentHTML('beforebegin', targetChip)
}
}
- childNodes[childNodes.length-1].insertAdjacentHTML("afterend", targetChip);
},0);
}
- dragOverHandler(event){
+ dragOverHandler(event) {
event.preventDefault();
}
- dragEnterHandler(event){
+ dragEnterHandler(event) {
event.preventDefault();
- event.target.style.borderStyle = "solid dotted";
+ event.target.style.borderStyle = 'solid dotted';
}
- dragLeaveHandler(event){
+ dragLeaveHandler(event) {
event.preventDefault();
- event.target.style.borderStyle = "hidden";
+ event.target.style.borderStyle = 'hidden';
}
- dragEndHandler(event){
+ dragEndHandler(event) {
let targets = document.querySelectorAll('.target');
- for (let target of targets){
+ for (let target of targets) {
target.remove();
}
}
- dropHandler(event){
+ dropHandler(event) {
let dropzone = event.target;
-
- for (let i = 0; i < dropzone.parentElement.childNodes.length; i++){
- if (dropzone === dropzone.parentElement.childNodes[i]){
- nodeIndex = i;
- }
- }
- for (let i = 0; i < dropzone.parentElement.childNodes.length; i++){
- if (this.elements.dropButton === dropzone.parentElement.childNodes[i]){
- draggedElementIndex = i;
- }
- }
-
dropzone.parentElement.replaceChild(this.elements.dropButton, dropzone);
this.queryPreviewBuilder();
}
//#endregion Drag&Drop Events
- queryPreviewBuilder(){
+ queryPreviewBuilder() {
this.elements.yourQueryContent = [];
-
for (let element of this.elements.yourQuery.childNodes) {
let queryElement = decodeURI(element.dataset.query);
- if (queryElement.includes("<")){
- queryElement = queryElement.replace("<", "<");
+ if (queryElement.includes('<')) {
+ queryElement = queryElement.replace('<', '<');
}
- if (queryElement.includes(">")){
- queryElement = queryElement.replace(">", ">");
+ if (queryElement.includes('>')) {
+ queryElement = queryElement.replace('>', '>');
}
- if (queryElement !== "undefined") {
+ if (queryElement !== 'undefined') {
this.elements.yourQueryContent.push(queryElement);
}
}
let queryString = this.elements.yourQueryContent.join(' ');
- queryString += ";";
+ queryString += ';';
this.elements.queryPreview.innerHTML = queryString;
}
deleteAttr(attr) {
this.elements.yourQuery.removeChild(attr);
-
- this.elements.counter -= 1;
- if(this.elements.counter === 0){
- this.elements.queryContainer.classList.add("hide");
+ if (attr.dataset.type === "start-sentence") {
+ this.elements.sentence.innerHTML = 'Sentence';
+ } else if (attr.dataset.type === "start-entity" || attr.dataset.type === "start-empty-entity") {
+ this.elements.entity.innerHTML = 'Entity';
+ }
+ this.elements.counter -= 1;
+ if (this.elements.counter === 0) {
+ this.elements.queryContainer.classList.add('hide');
}
-
this.queryPreviewBuilder();
}
insertQuery() {
this.elements.yourQueryContent = [];
+ this.validateValue();
+ if (this.elements.valueValidator === true) {
+ for (let element of this.elements.yourQuery.childNodes) {
+ let queryElement = decodeURI(element.dataset.query);
+ if (queryElement !== 'undefined') {
+ this.elements.yourQueryContent.push(queryElement);
+ }
+ }
+ let queryString = this.elements.yourQueryContent.join(' ');
+ queryString += ';';
+
+ this.elements.concordanceQueryBuilder.classList.add('modal-close');
+ this.elements.extFormQuery.value = queryString;
+ }
+ }
+
+ validateValue() {
+ this.elements.valueValidator = true;
+ let sentenceCounter = 0;
+ let sentenceEndCounter = 0;
+ let entityCounter = 0;
+ let entityEndCounter = 0;
for (let element of this.elements.yourQuery.childNodes) {
- let queryElement = decodeURI(element.dataset.query);
- if (queryElement !== "undefined"){
- this.elements.yourQueryContent.push(queryElement);
+ if (element.dataset.type === 'start-sentence') {
+ sentenceCounter += 1;
+ }else if (element.dataset.type === 'end-sentence') {
+ sentenceEndCounter += 1;
+ }else if (element.dataset.type === 'start-entity' || element.dataset.type === 'start-empty-entity') {
+ entityCounter += 1;
+ }else if (element.dataset.type === 'end-entity') {
+ entityEndCounter += 1;
+ }
}
+ // Checks if the same number of opening and closing tags (entity and sentence) are present. Depending on what is missing, the corresponding error message is ejected
+ if (sentenceCounter > sentenceEndCounter) {
+ app.flash('Please add the closing sentence tag', 'error');
+ this.elements.valueValidator = false;
+ } else if (sentenceCounter < sentenceEndCounter) {
+ app.flash('Please remove the closing sentence tag', 'error');
+ this.elements.valueValidator = false;
+ }
+ if (entityCounter > entityEndCounter) {
+ app.flash('Please add the closing entity tag', 'error');
+ this.elements.valueValidator = false;
+ } else if (entityCounter < entityEndCounter) {
+ app.flash('Please remove the closing entity tag', 'error');
+ this.elements.valueValidator = false;
}
-
- let queryString = this.elements.yourQueryContent.join(' ');
- queryString += ";";
-
- this.elements.concordanceQueryBuilder.classList.add('modal-close');
- this.elements.extFormQuery.value = queryString;
-
}
clearAll() {
- // Everything is reset. After 5 seconds for 5 seconds (with "instance"), a message is displayed indicating that further information can be obtained via the question mark icon
+ // Everything is reset. After 5 seconds for 5 seconds (with 'instance'), a message is displayed indicating that further information can be obtained via the question mark icon
let instance = M.Tooltip.getInstance(this.elements.queryBuilderTutorialInfoIcon);
this.hideEverything();
@@ -387,6 +390,8 @@ class ConcordanceQueryBuilder {
this.elements.structuralAttrArea.classList.add('hide');
this.elements.yourQuery.innerHTML = '';
this.elements.queryContainer.classList.add('hide');
+ this.elements.entity.innerHTML = 'Entity';
+ this.elements.sentence.innerHTML = 'Sentence';
instance.tooltipEl.style.background = '#98ACD2';
instance.tooltipEl.style.borderTop = 'solid 4px #0064A3';
@@ -411,28 +416,33 @@ class ConcordanceQueryBuilder {
//#endregion General Functions
+
+ // ##########################################################################
+ // ############## Token Attribute Builder Functions #########################
+ // ##########################################################################
+
//#region Token Attribute Builder Functions
- //#region General functions of the Token Builder
+ //#region General functions of the Token Builder
tokenTypeSelector() {
this.hideEverything();
switch (this.elements.positionalAttr.value) {
- case "word":
+ case 'word':
this.wordBuilder();
break;
- case "lemma":
+ case 'lemma':
this.lemmaBuilder();
break;
- case "english-pos":
+ case 'english-pos':
this.englishPosHandler();
break;
- case "german-pos":
+ case 'german-pos':
this.germanPosHandler();
break;
- case "simple-pos-button":
+ case 'simple-pos-button':
this.simplePosBuilder();
break;
- case "empty-token":
+ case 'empty-token':
this.emptyTokenHandler();
break;
default:
@@ -441,19 +451,19 @@ class ConcordanceQueryBuilder {
}
}
- hideEverything(){
+ 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.incidenceModifiersButton.classList.add("hide");
- this.elements.conditionContainer.classList.add("hide");
- this.elements.englishPosBuilder.classList.add("hide");
- this.elements.germanPosBuilder.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.incidenceModifiersButton.classList.add('hide');
+ this.elements.conditionContainer.classList.add('hide');
+ this.elements.englishPosBuilder.classList.add('hide');
+ this.elements.germanPosBuilder.classList.add('hide');
+ this.elements.simplePosBuilder.classList.add('hide');
+ this.elements.entityBuilder.classList.add('hide');
+ this.elements.textAnnotationBuilder.classList.add('hide');
}
@@ -463,20 +473,16 @@ class ConcordanceQueryBuilder {
let buttonElement;
builderElement = document.createElement('div');
builderElement.innerHTML = `
-
+
${prettyText}
- close
+ close
`;
buttonElement = builderElement.firstElementChild;
- buttonElement.addEventListener("click", () => {this.deleteTokenAttr(buttonElement);});
+ buttonElement.addEventListener('click', () => {this.deleteTokenAttr(buttonElement);});
this.elements.tokenQuery.appendChild(buttonElement);
}
- deleteTokenAttr(attr){
- // let tokenQuery = this.elements.tokenQuery.childNodes;
- // console.log(tokenQuery);
- // console.log(this.elements.tokenQuery);
- console.log(this.elements.tokenQuery.childNodes.length);
+ deleteTokenAttr(attr) {
if (this.elements.tokenQuery.childNodes.length < 2) {
this.elements.tokenQuery.removeChild(attr);
this.wordBuilder();
@@ -488,30 +494,30 @@ class ConcordanceQueryBuilder {
addToken() {
let c;
- let tokenQueryContent = ""; //for ButtonFactory(prettyText)
- let tokenQueryText = ""; //for ButtonFactory(queryText)
+ let tokenQueryContent = ''; //for ButtonFactory(prettyText)
+ let tokenQueryText = ''; //for ButtonFactory(queryText)
this.elements.cancelBool = false;
let emptyTokenCheck = false;
- if (this.elements.ignoreCase.checked){
+ if (this.elements.ignoreCase.checked) {
c = ' %c';
- }else{
+ } else {
c = '';
}
- for (let element of this.elements.tokenQuery.childNodes){
+ for (let element of this.elements.tokenQuery.childNodes) {
tokenQueryContent += ' ' + element.firstChild.data + ' ';
tokenQueryText += decodeURI(element.dataset.tokentext);
- if (element.innerText.indexOf("empty token") !== -1){
+ if (element.innerText.indexOf('empty token') !== -1) {
emptyTokenCheck = true;
}
}
- if (this.elements.tokenQueryFilled === false){
+ if (this.elements.tokenQueryFilled === false) {
switch (this.elements.positionalAttr.value) {
- case "word":
- if (this.elements.wordInput.value === "") {
+ case 'word':
+ if (this.elements.wordInput.value === '') {
this.disableTokenSubmit();
} else {
tokenQueryContent += `word=${this.elements.wordInput.value}${c}`;
@@ -519,8 +525,8 @@ class ConcordanceQueryBuilder {
this.elements.wordInput.value = '';
}
break;
- case "lemma":
- if (this.elements.lemmaInput.value === "") {
+ case 'lemma':
+ if (this.elements.lemmaInput.value === '') {
this.disableTokenSubmit();
} else {
tokenQueryContent += `lemma=${this.elements.lemmaInput.value}${c}`;
@@ -528,8 +534,8 @@ class ConcordanceQueryBuilder {
this.elements.lemmaInput.value = '';
}
break;
- case "english-pos":
- if (this.elements.englishPos.value === "default") {
+ case 'english-pos':
+ if (this.elements.englishPos.value === 'default') {
this.disableTokenSubmit();
} else {
tokenQueryContent += `pos=${this.elements.englishPos.value}`;
@@ -537,8 +543,8 @@ class ConcordanceQueryBuilder {
this.elements.englishPos.value = '';
}
break;
- case "german-pos":
- if (this.elements.germanPos.value === "default") {
+ case 'german-pos':
+ if (this.elements.germanPos.value === 'default') {
this.disableTokenSubmit();
} else {
tokenQueryContent += `pos=${this.elements.germanPos.value}`;
@@ -546,8 +552,8 @@ class ConcordanceQueryBuilder {
this.elements.germanPos.value = '';
}
break;
- case "simple-pos-button":
- if (this.elements.simplePos.value === "default") {
+ case 'simple-pos-button':
+ if (this.elements.simplePos.value === 'default') {
this.disableTokenSubmit();
} else {
tokenQueryContent += `simple_pos=${this.elements.simplePos.value}`;
@@ -562,25 +568,25 @@ class ConcordanceQueryBuilder {
}
// cancelBool looks in disableTokenSubmit() whether a value is passed. If the input fields/dropdowns are empty (cancelBool === true), no token is added.
- if (this.elements.cancelBool === false){
+ if (this.elements.cancelBool === false) {
// Square brackets are added only if it is not an empty token (where they are already present).
if (emptyTokenCheck === false) {
tokenQueryText = '[' + tokenQueryText + ']';
- }
+ }
this.buttonfactory('token', tokenQueryContent, tokenQueryText);
this.hideEverything();
this.elements.positionalAttrArea.classList.add('hide');
- this.elements.tokenQuery.innerHTML = "";
+ this.elements.tokenQuery.innerHTML = '';
}
}
disableTokenSubmit() {
this.elements.cancelBool = true;
- this.elements.tokenSubmitButton.classList.add("red");
+ this.elements.tokenSubmitButton.classList.add('red');
this.elements.noValueMessage.classList.remove('hide');
setTimeout(() => {
- this.elements.tokenSubmitButton.classList.remove("red");
+ this.elements.tokenSubmitButton.classList.remove('red');
}, 500);
setTimeout(() => {
this.elements.noValueMessage.classList.add('hide');
@@ -592,75 +598,75 @@ class ConcordanceQueryBuilder {
//#region Dropdown Select Handler
wordBuilder() {
this.hideEverything();
- this.elements.wordInput.value = "";
- this.elements.wordBuilder.classList.remove("hide");
- this.elements.inputOptions.classList.remove("hide");
+ this.elements.wordInput.value = '';
+ this.elements.wordBuilder.classList.remove('hide');
+ this.elements.inputOptions.classList.remove('hide');
this.elements.incidenceModifiersButton.classList.remove('hide');
- this.elements.conditionContainer.classList.remove("hide");
- this.elements.ignoreCaseCheckbox.classList.remove("hide");
+ this.elements.conditionContainer.classList.remove('hide');
+ this.elements.ignoreCaseCheckbox.classList.remove('hide');
// Resets materialize select field to default value
let SelectInstance = M.FormSelect.getInstance(this.elements.positionalAttr);
- SelectInstance.input.value = "word";
- this.elements.positionalAttr.value = "word";
+ SelectInstance.input.value = 'word';
+ this.elements.positionalAttr.value = 'word';
}
lemmaBuilder() {
this.hideEverything();
- this.elements.lemmaBuilder.classList.remove("hide");
- this.elements.inputOptions.classList.remove("hide");
+ this.elements.lemmaBuilder.classList.remove('hide');
+ this.elements.inputOptions.classList.remove('hide');
this.elements.incidenceModifiersButton.classList.remove('hide');
- this.elements.conditionContainer.classList.remove("hide");
- this.elements.ignoreCaseCheckbox.classList.remove("hide");
+ this.elements.conditionContainer.classList.remove('hide');
+ this.elements.ignoreCaseCheckbox.classList.remove('hide');
}
englishPosHandler() {
this.hideEverything();
- this.elements.englishPosBuilder.classList.remove("hide");
+ this.elements.englishPosBuilder.classList.remove('hide');
this.elements.incidenceModifiersButton.classList.remove('hide');
- this.elements.conditionContainer.classList.remove("hide");
+ this.elements.conditionContainer.classList.remove('hide');
// Resets materialize select dropdown
let selectInstance = M.FormSelect.getInstance(this.elements.englishPos);
- selectInstance.input.value = "English pos tagset";
- this.elements.englishPos.value = "default";
+ selectInstance.input.value = 'English pos tagset';
+ this.elements.englishPos.value = 'default';
}
germanPosHandler() {
this.hideEverything();
- this.elements.germanPosBuilder.classList.remove("hide");
+ this.elements.germanPosBuilder.classList.remove('hide');
this.elements.incidenceModifiersButton.classList.remove('hide');
- this.elements.conditionContainer.classList.remove("hide");
+ this.elements.conditionContainer.classList.remove('hide');
// Resets materialize select dropdown
let selectInstance = M.FormSelect.getInstance(this.elements.germanPos);
- selectInstance.input.value = "German pos tagset";
- this.elements.germanPos.value = "default";
+ selectInstance.input.value = 'German pos tagset';
+ this.elements.germanPos.value = 'default';
}
simplePosBuilder() {
this.hideEverything();
- this.elements.simplePosBuilder.classList.remove("hide");
+ this.elements.simplePosBuilder.classList.remove('hide');
this.elements.incidenceModifiersButton.classList.remove('hide');
- this.elements.conditionContainer.classList.remove("hide");
+ this.elements.conditionContainer.classList.remove('hide');
this.elements.simplePos.selectedIndex = 0;
// Resets materialize select dropdown
let selectInstance = M.FormSelect.getInstance(this.elements.simplePos);
- selectInstance.input.value = "simple_pos tagset";
- this.elements.simplePos.value = "default";
+ selectInstance.input.value = 'simple_pos tagset';
+ this.elements.simplePos.value = 'default';
}
emptyTokenHandler() {
- this.tokenButtonfactory("empty token", "[]");
+ this.tokenButtonfactory('empty token', '[]');
this.elements.tokenQueryFilled = true;
this.hideEverything();
this.elements.incidenceModifiersButton.classList.remove('hide');
}
//#endregion Dropdown Select Handler
- //#region Options to edit your token - Wildcard Charakter, Option Group, Incidence Modifiers, Ignore Case, "and", "or"
+ //#region Options to edit your token - Wildcard Charakter, Option Group, Incidence Modifiers, Ignore Case, 'and', 'or'
inputOptionHandler(elem) {
let input;
@@ -687,35 +693,35 @@ class ConcordanceQueryBuilder {
instance.close();
switch (this.elements.positionalAttr.value) {
- case "word":
- this.elements.wordInput.value += " {" + this.elements.nInput.value + "}";
+ case 'word':
+ this.elements.wordInput.value += ' {' + this.elements.nInput.value + '}';
break;
- case "lemma":
- this.elements.lemmaInput.value += " {" + this.elements.nInput.value + "}";
+ case 'lemma':
+ this.elements.lemmaInput.value += ' {' + this.elements.nInput.value + '}';
break;
- case "english-pos":
+ case 'english-pos':
this.elements.tokenQueryFilled = true;
this.tokenButtonfactory(`pos=${this.elements.englishPos.value}`, `pos="${this.elements.englishPos.value}"`);
- this.tokenButtonfactory("{" + this.elements.nInput.value + "}", "{" + this.elements.nInput.value + "}");
- this.elements.englishPosBuilder.classList.add("hide");
- this.elements.incidenceModifiersButton.classList.add("hide");
+ this.tokenButtonfactory('{' + this.elements.nInput.value + '}', '{' + this.elements.nInput.value + '}');
+ this.elements.englishPosBuilder.classList.add('hide');
+ this.elements.incidenceModifiersButton.classList.add('hide');
break;
- case "german-pos":
+ case 'german-pos':
this.elements.tokenQueryFilled = true;
this.tokenButtonfactory(`pos=${this.elements.germanPos.value}`, `pos="${this.elements.germanPos.value}"`);
- this.tokenButtonfactory("{" + this.elements.nInput.value + "}", "{" + this.elements.nInput.value + "}");
- this.elements.germanPosBuilder.classList.add("hide");
- this.elements.incidenceModifiersButton.classList.add("hide");
+ this.tokenButtonfactory('{' + this.elements.nInput.value + '}', '{' + this.elements.nInput.value + '}');
+ this.elements.germanPosBuilder.classList.add('hide');
+ this.elements.incidenceModifiersButton.classList.add('hide');
break;
- case "simple-pos-button":
+ case 'simple-pos-button':
this.elements.tokenQueryFilled = true;
this.tokenButtonfactory(`simple_pos=${this.elements.simplePos.value}`, `simple_pos="${this.elements.simplePos.value}"`);
- this.tokenButtonfactory("{" + this.elements.nInput.value + "}", "{" + this.elements.nInput.value + "}");
- this.elements.simplePosBuilder.classList.add("hide");
- this.elements.incidenceModifiersButton.classList.add("hide");
+ this.tokenButtonfactory('{' + this.elements.nInput.value + '}', '{' + this.elements.nInput.value + '}');
+ this.elements.simplePosBuilder.classList.add('hide');
+ this.elements.incidenceModifiersButton.classList.add('hide');
break;
- case "empty-token":
- this.tokenButtonfactory("{" + this.elements.nInput.value + "}", "{" + this.elements.nInput.value + "}");
+ case 'empty-token':
+ this.tokenButtonfactory('{' + this.elements.nInput.value + '}', '{' + this.elements.nInput.value + '}');
break;
default:
break;
@@ -728,34 +734,34 @@ class ConcordanceQueryBuilder {
instance.close();
switch (this.elements.positionalAttr.value) {
- case "word":
+ case 'word':
this.elements.wordInput.value += `{${this.elements.nmInput.value}, ${this.elements.mInput.value}}`;
break;
- case "lemma":
+ case 'lemma':
this.elements.lemmaInput.value += `{${this.elements.nmInput.value}, ${this.elements.mInput.value}}`;
break;
- case "english-pos":
+ case 'english-pos':
this.elements.tokenQueryFilled = true;
this.tokenButtonfactory(`pos=${this.elements.englishPos.value}`, `pos="${this.elements.englishPos.value}"`);
this.tokenButtonfactory(`{${this.elements.nmInput.value}, ${this.elements.mInput.value}}`, `{${this.elements.nmInput.value}, ${this.elements.mInput.value}}`);
- this.elements.englishPosBuilder.classList.add("hide");
- this.elements.incidenceModifiersButton.classList.add("hide");
+ this.elements.englishPosBuilder.classList.add('hide');
+ this.elements.incidenceModifiersButton.classList.add('hide');
break;
- case "german-pos":
+ case 'german-pos':
this.elements.tokenQueryFilled = true;
this.tokenButtonfactory(`pos=${this.elements.germanPos.value}`, `pos="${this.elements.germanPos.value}"`);
this.tokenButtonfactory(`{${this.elements.nmInput.value}, ${this.elements.mInput.value}}`, `{${this.elements.nmInput.value}, ${this.elements.mInput.value}}`);
- this.elements.germanPosBuilder.classList.add("hide");
- this.elements.incidenceModifiersButton.classList.add("hide");
+ this.elements.germanPosBuilder.classList.add('hide');
+ this.elements.incidenceModifiersButton.classList.add('hide');
break;
- case "simple-pos-button":
+ case 'simple-pos-button':
this.elements.tokenQueryFilled = true;
this.tokenButtonfactory(`simple_pos=${this.elements.simplePos.value}`, `simple_pos="${this.elements.simplePos.value}"`);
this.tokenButtonfactory(`{${this.elements.nmInput.value}, ${this.elements.mInput.value}}`, `{${this.elements.nmInput.value}, ${this.elements.mInput.value}}`);
- this.elements.simplePosBuilder.classList.add("hide");
- this.elements.incidenceModifiersButton.classList.add("hide");
+ this.elements.simplePosBuilder.classList.add('hide');
+ this.elements.incidenceModifiersButton.classList.add('hide');
break;
- case "empty-token":
+ case 'empty-token':
this.tokenButtonfactory(`{${this.elements.nmInput.value}, ${this.elements.mInput.value}}`, `{${this.elements.nmInput.value}, ${this.elements.mInput.value}}`);
break;
default:
@@ -765,25 +771,25 @@ class ConcordanceQueryBuilder {
incidenceModifiersHandler(elem) {
// For word and lemma, the incidence modifiers are inserted in the input field. For the others, one or two chips are created which contain the respective value of the token and the incidence modifier.
- if (this.elements.positionalAttr.value === "empty-token") {
+ if (this.elements.positionalAttr.value === 'empty-token') {
this.tokenButtonfactory(elem.innerText, elem.dataset.token);
- } else if (this.elements.positionalAttr.value === "english-pos") {
+ } else if (this.elements.positionalAttr.value === 'english-pos') {
this.tokenButtonfactory(`pos=${this.elements.englishPos.value}`, `pos="${this.elements.englishPos.value}"`);
this.tokenButtonfactory(elem.innerText, elem.dataset.token);
- this.elements.englishPosBuilder.classList.add("hide");
- this.elements.incidenceModifiersButton.classList.add("hide");
+ this.elements.englishPosBuilder.classList.add('hide');
+ this.elements.incidenceModifiersButton.classList.add('hide');
this.elements.tokenQueryFilled = true;
- } else if (this.elements.positionalAttr.value === "german-pos") {
+ } else if (this.elements.positionalAttr.value === 'german-pos') {
this.tokenButtonfactory(`pos=${this.elements.germanPos.value}`, `pos="${this.elements.germanPos.value}"`);
this.tokenButtonfactory(elem.innerText, elem.dataset.token);
- this.elements.germanPosBuilder.classList.add("hide");
- this.elements.incidenceModifiersButton.classList.add("hide");
+ this.elements.germanPosBuilder.classList.add('hide');
+ this.elements.incidenceModifiersButton.classList.add('hide');
this.elements.tokenQueryFilled = true;
- } else if (this.elements.positionalAttr.value === "simple-pos-button") {
+ } else if (this.elements.positionalAttr.value === 'simple-pos-button') {
this.tokenButtonfactory(`simple_pos=${this.elements.simplePos.value}`, `simple_pos="${this.elements.simplePos.value}"`);
this.tokenButtonfactory(elem.innerText, elem.dataset.token);
- this.elements.simplePosBuilder.classList.add("hide");
- this.elements.incidenceModifiersButton.classList.add("hide");
+ this.elements.simplePosBuilder.classList.add('hide');
+ this.elements.incidenceModifiersButton.classList.add('hide');
this.elements.tokenQueryFilled = true;
} else {
let input;
@@ -800,11 +806,11 @@ class ConcordanceQueryBuilder {
}
orHandler() {
- this.conditionHandler("or", " | ");
+ this.conditionHandler('or', ' | ');
}
andHandler() {
- this.conditionHandler("and", " & ");
+ this.conditionHandler('and', ' & ');
}
conditionHandler(conditionText, conditionQueryContent) {
@@ -813,34 +819,34 @@ class ConcordanceQueryBuilder {
let tokenQueryText;
let c;
- if (this.elements.ignoreCase.checked){
+ if (this.elements.ignoreCase.checked) {
c = ' %c';
- }else{
+ } else {
c = '';
}
switch (this.elements.positionalAttr.value) {
- case "word":
+ case 'word':
tokenQueryContent = `word=${this.elements.wordInput.value}${c}`;
tokenQueryText = `word="${this.elements.wordInput.value}"${c}`;
this.elements.wordInput.value = '';
break;
- case "lemma":
+ case 'lemma':
tokenQueryContent = `lemma=${this.elements.lemmaInput.value}${c}`;
- tokenQueryText = `word="${this.elements.lemmaInput.value}"${c}`;
+ tokenQueryText = `lemma="${this.elements.lemmaInput.value}"${c}`;
this.elements.lemmaInput.value = '';
break;
- case "english-pos":
+ case 'english-pos':
tokenQueryContent = `pos=${this.elements.englishPos.value}`;
tokenQueryText = `pos="${this.elements.englishPos.value}"`;
this.elements.englishPos.value = '';
break;
- case "german-pos":
+ case 'german-pos':
tokenQueryContent = `pos=${this.elements.germanPos.value}`;
tokenQueryText = `pos="${this.elements.germanPos.value}"`;
this.elements.germanPos.value = '';
break;
- case "simple-pos-button":
+ case 'simple-pos-button':
tokenQueryContent = `simple_pos=${this.elements.simplePos.value}`;
tokenQueryText = `simple_pos="${this.elements.simplePos.value}"`;
this.elements.simplePos.value = '';
@@ -855,14 +861,19 @@ class ConcordanceQueryBuilder {
this.wordBuilder();
}
- //#endregion Options to edit your token - Wildcard Charakter, Option Group, Incidence Modifiers, Ignore Case, "and", "or"
+ //#endregion Options to edit your token - Wildcard Charakter, Option Group, Incidence Modifiers, Ignore Case, 'and', 'or'
//#endregion Token Attribute Builder Functions
+
+ // ##########################################################################
+ // ############ Structural Attribute Builder Functions ######################
+ // ##########################################################################
+
//#region Structural Attribute Builder Functions
addSentence() {
this.hideEverything();
- if(this.elements.sentence.text === 'End Sentence') {
+ if (this.elements.sentence.text === 'End Sentence') {
this.buttonfactory('end-sentence', 'Sentence End', '');
this.elements.sentence.innerHTML = 'Sentence';
} else {
@@ -884,8 +895,8 @@ class ConcordanceQueryBuilder {
this.elements.entity.innerHTML = 'Entity';
} else {
this.hideEverything();
- this.elements.entityBuilder.classList.remove("hide");
- window.location.href = "#entity-builder";
+ this.elements.entityBuilder.classList.remove('hide');
+ window.location.href = '#entity-builder';
}
}
@@ -897,8 +908,8 @@ class ConcordanceQueryBuilder {
// Resets materialize select dropdown
let SelectInstance = M.FormSelect.getInstance(this.elements.englishEntType);
- SelectInstance.input.value = "English ent_type";
- this.elements.englishEntType.value = "default";
+ SelectInstance.input.value = 'English ent_type';
+ this.elements.englishEntType.value = 'default';
}
germanEntTypeHandler() {
@@ -909,8 +920,8 @@ class ConcordanceQueryBuilder {
// Resets materialize select dropdown
let SelectInstance = M.FormSelect.getInstance(this.elements.germanEntType);
- SelectInstance.input.value = "German ent_type";
- this.elements.germanEntType.value = "default";
+ SelectInstance.input.value = 'German ent_type';
+ this.elements.germanEntType.value = 'default';
}
emptyEntityButton() {
@@ -922,14 +933,14 @@ class ConcordanceQueryBuilder {
addTextAnnotation() {
this.hideEverything();
- this.elements.textAnnotationBuilder.classList.remove("hide");
- window.location.href = "#text-annotation-builder";
+ this.elements.textAnnotationBuilder.classList.remove('hide');
+ window.location.href = '#text-annotation-builder';
// Resets materialize select dropdown
let SelectInstance = M.FormSelect.getInstance(this.elements.textAnnotationOptions);
- SelectInstance.input.value = "address";
- this.elements.textAnnotationOptions.value = "address";
- this.elements.textAnnotationInput.value= "";
+ SelectInstance.input.value = 'address';
+ this.elements.textAnnotationOptions.value = 'address';
+ this.elements.textAnnotationInput.value= '';
}
textAnnotationSubmitHandler() {
@@ -948,12 +959,6 @@ class ConcordanceQueryBuilder {
this.hideEverything();
}
}
-
-
-//#endregion Structural Attribute Builder Functions
-
-
-
-
+ //#endregion Structural Attribute Builder Functions
+
}
-
diff --git a/app/templates/_styles.html.j2 b/app/templates/_styles.html.j2
index 2c1ea8f8..cb047f8f 100644
--- a/app/templates/_styles.html.j2
+++ b/app/templates/_styles.html.j2
@@ -4,6 +4,7 @@
+
{%- assets
filters='pyscss',
output='gen/app.%(version)s.css',
diff --git a/app/templates/contributions/contribute.html.j2 b/app/templates/contributions/contribute.html.j2
new file mode 100644
index 00000000..6789e1f8
--- /dev/null
+++ b/app/templates/contributions/contribute.html.j2
@@ -0,0 +1,32 @@
+{% extends "base.html.j2" %}
+{% import "materialize/wtf.html.j2" as wtf %}
+
+
+{% block page_content %}
+
+
+
+
{{ title }}
+
+ In order to add a new model, please fill in the form below.
+
+
+
+
+
+{% endblock page_content %}
\ No newline at end of file
diff --git a/app/templates/corpora/analyse_corpus.concordance.html.j2 b/app/templates/corpora/analyse_corpus.concordance.html.j2
index 0fc14597..e19a3728 100644
--- a/app/templates/corpora/analyse_corpus.concordance.html.j2
+++ b/app/templates/corpora/analyse_corpus.concordance.html.j2
@@ -64,9 +64,9 @@
+
+
+
{% endblock modals %}
{% block scripts %}
@@ -256,6 +611,7 @@
const corpusAnalysisApp = new CorpusAnalysisApp({{ corpus.hashid|tojson }});
const corpusAnalysisConcordance = new CorpusAnalysisConcordance(corpusAnalysisApp);
const corpusAnalysisReader = new CorpusAnalysisReader(corpusAnalysisApp);
+const concordanceQueryBuilder = new ConcordanceQueryBuilder();
corpusAnalysisApp.init();
diff --git a/app/templates/main/manual/_09_query_builder.html.j2 b/app/templates/main/manual/_09_query_builder.html.j2
index f22e5369..ff3544eb 100644
--- a/app/templates/main/manual/_09_query_builder.html.j2
+++ b/app/templates/main/manual/_09_query_builder.html.j2
@@ -38,14 +38,14 @@ under the tab "Examples".
Submit button on the right. You can also use the options below to modify your
token request before pressing the submit button. These options are explained
further here.
-
+
English pos, german pos or simple_pos
You can choose between the options "english pos", "german pos" and
"simple_pos" to search for different parts-of-speech. You can find an overview
of all tags under the "Tagsets" tab.
-
+
Empty Token
Here you can search for an empty token. This selection should never stand
@@ -75,7 +75,7 @@ under the tab "Examples".
With an option group you can search for different variants of a token. The
variants are not limited, so you can manually enter more options in the same
format. "Option1" and "option2" must be replaced accordingly.
-
+
@@ -100,7 +100,7 @@ under the tab "Examples".
it will be displayed. Note that "and" is not responsible for lining up tokens in
this case. For this you can simply string them together:
[word="I"] [word="will" & simple_pos="VERB"] [word="go"].
-
+
@@ -134,7 +134,7 @@ under the tab "Examples".
the respective abbreviations under the tab "Tagsets".
You can also search for unspecified entities by selecting "Add entity of any type".
To close the entity query you started, you have to click the entity button one more time. This will make the
Entity End
element appear in your query.
-
+
@@ -142,7 +142,7 @@ under the tab "Examples".
With the meta data you can annotate your text and add specific conditions.
You can select a category on the left and enter your desired value on the right.
The selected metadata will apply to your entire request and will be added at the end.
-
+
@@ -158,11 +158,11 @@ under the tab "Examples".
Deleting the elements
You can delete the added elements from the query by clicking the X behind the respective content.
-
+
Move the elements of your query
You can drag and drop elements to customize your query.
-
+
diff --git a/app/templates/services/tesseract_ocr_pipeline.html.j2 b/app/templates/services/tesseract_ocr_pipeline.html.j2
index c38c3965..982265bc 100644
--- a/app/templates/services/tesseract_ocr_pipeline.html.j2
+++ b/app/templates/services/tesseract_ocr_pipeline.html.j2
@@ -160,8 +160,8 @@
- {% for m in tesseract_ocr_models %}
-