From 1dd5acd66f7ef9e0bced41f81eabc8ac30f2508a Mon Sep 17 00:00:00 2001 From: Kai Labusch Date: Mon, 28 Oct 2019 15:38:14 +0100 Subject: [PATCH] add split/merge functionality --- ner-edith.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/ner-edith.js b/ner-edith.js index 86ae4ea..ef250bc 100644 --- a/ner-edith.js +++ b/ner-edith.js @@ -101,7 +101,6 @@ function setupInterface(data, file) { if (isOk) { - console.log('hello world'); let newValue = $('#edit-area').val(); $(td).html(newValue); @@ -172,9 +171,11 @@ function setupInterface(data, file) { } let pos = tableInfo.nRow + 1; + word_pos = data.data[tableInfo.nRow - 1]['No.'] + 1 while((pos < data.data.length) && (data.data[pos]['No.'] > 1)) { - data.data[pos]['No.']--; + data.data[pos]['No.'] = word_pos; pos++; + word_pos++; } data.data[tableInfo.nRow - 1]['TOKEN'] += data.data[tableInfo.nRow]['TOKEN']; @@ -192,6 +193,15 @@ function setupInterface(data, file) { pos++; } } + else if (editingTd.tokenizer_action.includes('start-sentence')) { + let pos = tableInfo.nRow; + let word_pos = 1; + while ((pos < data.data.length) && (data.data[pos]['No.'] != 1)) { + data.data[pos]['No.'] = word_pos; + pos++; + word_pos++; + } + } editingTd = null; @@ -203,6 +213,7 @@ function setupInterface(data, file) {
↕  split
⟳ merge-above
+
start-sentence
`; @@ -355,8 +366,6 @@ function setupInterface(data, file) { startIndex = data.data.length - this.value; endIndex = startIndex + displayRows; - console.log(startIndex); - updateTable(); });