mirror of
https://github.com/qurator-spk/neat.git
synced 2025-06-12 05:09:54 +02:00
start sentence inserts empty row
This commit is contained in:
parent
d7737557f7
commit
99e8b53e15
1 changed files with 14 additions and 3 deletions
17
neath.js
17
neath.js
|
@ -290,7 +290,7 @@ function setupInterface(data, file, urls) {
|
|||
else if (editingTd.tokenizer_action.includes('split')) {
|
||||
|
||||
data.data.splice(tableInfo.nRow, 0, JSON.parse(JSON.stringify(data.data[tableInfo.nRow])));
|
||||
data.data[tableInfo.nRow + 1]['No.'] += 1
|
||||
data.data[tableInfo.nRow + 1]['No.'] += 1
|
||||
|
||||
let pos = tableInfo.nRow + 2;
|
||||
while ((pos < data.data.length) && (data.data[pos]['No.'] > 1)) {
|
||||
|
@ -300,10 +300,21 @@ function setupInterface(data, file, urls) {
|
|||
|
||||
notifyChange();
|
||||
}
|
||||
else if (editingTd.tokenizer_action.includes('start-sentence')) {
|
||||
else if (editingTd.tokenizer_action.includes('sentence')) {
|
||||
|
||||
let pos = tableInfo.nRow;
|
||||
|
||||
let new_row = JSON.parse(JSON.stringify(data.data[pos]))
|
||||
|
||||
console.log(new_row)
|
||||
|
||||
data.data.splice(pos, 0, new_row);
|
||||
data.data[pos]['No.'] = 0
|
||||
data.data[pos]['TOKEN'] = ''
|
||||
pos += 1
|
||||
|
||||
let word_pos = 1;
|
||||
while ((pos < data.data.length) && (data.data[pos]['No.'] != 1)) {
|
||||
while ((pos < data.data.length) && (data.data[pos]['No.'] != 1) && (data.data[pos]['TOKEN'] != '') ) {
|
||||
data.data[pos]['No.'] = word_pos;
|
||||
pos++;
|
||||
word_pos++;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue