<h3>ner.edith: named entity recognition editor in html</h3>
<tableid="results">
Please upload a TSV (tab-separated-values) file in the <ahref="https://sites.google.com/site/germeval2014ner/data">GermEval2014 data format</a>: <inputtype="file"id="tsv-file"name="files"/><br><br>
<tableid="table">
<thead>
<tr>
<th>OFFSET</th>
<th>POSITION</th>
<th>TOKEN</th>
<th>NE-TAG</th>
<th>NE-EMB</th>
</tr>
</thead>
<tbody></tbody>
<tbody></tbody>
</table>
</table>
<script>
<script>
var data;
var data;
@ -42,10 +55,65 @@
});
});
}
}
// https://javascript.info/task/edit-td-click
let table = document.getElementById('table');
let editingTd;
table.onclick = function(event) {
let target = event.target.closest('.edit-cancel,.edit-ok,td');
if (!table.contains(target)) return;
if (target.className == 'edit-cancel') {
finishTdEdit(editingTd.elem, false);
} else if (target.className == 'edit-ok') {
finishTdEdit(editingTd.elem, true);
} else if (target.nodeName == 'TD') {
if (editingTd) return;
makeTdEditable(target);
}
};
function makeTdEditable(td) {
editingTd = {
elem: td,
data: td.innerHTML
};
td.classList.add('edit-td');
let textArea = document.createElement('textarea');