We are working on an annotation project where annotators should annotate based on words not characters. However, sometimes such mistakes occur. How can restrict annotation so that individual
I could not find a way to do this in Brat.
We are working on an annotation project where annotators should annotate based on words not characters. However, sometimes such mistakes occur. How can restrict annotation so that individual
I could not find a way to do this in Brat.
It would be the easiest to instruct your annotators to double-click on a word instead of dragging the mouse, as a double click always selects the whole word.
However, if you want there is also a technical solution. This uses the Rangy Javascript library, which has functionality to expand a selection towards word boundaries. You can modify the source code of Brat to load this library and to perform the selection expansion every time the user presses Enter to annotate after selecting a (partial) word.
First, locate
index.xhtml
in your local Brat installation, which should be in the root folder. Add the following lines to the header where other Javascript libraries are loaded:For context, the header should look similar to the following after adding Rangy:
Then, locate
annotator_ui.js
. This file can be found inbrat/client/src
. Find line 1789, which should read:Add the following line to the top of the function definition:
For context, the start of the function should look as follows after the modification:
Reload the Brat interface. Then after selecting a partial word the full word will be presented in the annotation window, and saving the annotation will apply it to the full word as well.