Code Monkey home page Code Monkey logo

yedda's Introduction

YEDDA Logo


YEDDA: A Lightweight Collaborative Text Span Annotation Tool

About:

YEDDA (the previous SUTDAnnotator) is developed for annotating chunk/entity/event on text (almost all languages including English, Chinese), symbol and even emoji. It supports shortcut annotation which is extremely efficient to annotate text by hand. The user only need to select text span and press shortcut key, the span will be annotated automatically. It also support command annotation model which annotates multiple entities in batch and support export annotated text into sequence text. Besides, intelligent recommendation and adminstrator analysis is also included in updated version. It is compatiable with all mainstream operating systems includings Windows, Linux and MacOS.

For more details, please refer to our paper (ACL2018:demo, best demo nomination).

This GUI annotation tool is developed with tkinter package in Python.

System required: Python 3.6 or above

Author: Jie Yang, Assistant Professor at Zhejiang University, China.

Interface:

It provides both annotator interface for efficient annotatation and admin interface for result analysis.

  • Annotator Interface: alt text alt text
  • Administrator Interface: alt text

Use as an annotator ?

  • Start the interface: run python YEDDA.py
  • Select a shortcut map from ./configs/ in the right bottom drop-down list
  • Configure your shortcut map in the right side of annotation interface, you can leave other labels empty if the shortcut number is enough. For example: a: Action; b: Loc; c: Cont. You can also change the map directly on the file./configs/XX.config which is in JSON format.
  • Click the ReMap button to overwrite and store the map setting, or click the NewMap button to store the map setting in a new file under ./configs/
  • Click Open button and select your input file. (You may set your file name ended with .txt or .ann if possible)

This tool supports two ways of annotation (annotated text format [@the text span#Location*]):

  • Shortcut Key Annotation: select the text and press the corresponding shortcut (i.e. c for label Cont).
  • Command Line Annotation: type the code at command entry (at the bottom of the annotation interface). For example, type 2c3b1a end with <Enter>, it will annotate the following 2 character as type c: Cont, the following 3 character as type b: Loc, then the following 1 character as a: Action.

Intelligent recommendation:

  • Intelligent recommendation is enabled or disabled by the button RMOn and RMOff, respectively.
  • If recommendation model is enabled, system will recommend entities based on the annotated text. Recommendation span is formatted as [$the text span#Location*]in green color. (Notice the difference of annotated and recommended span, the former starts with [@ while the later starts with [$)

The annotated results will be stored synchronously. Annotated file is located at the same directory with origin file with the name of "origin name + .ann" Please also note that the shortcut map can be switched seamlessly in the right bottom drop-down list

Use as an administrator ?

YEDDA provides a simple interface for administartor to evaluate and analyze annotation quality among multiple annotators. After collected multiple annotated *.ann files from multiple annotators (annotated on same plain text), YEDDA can give two toolkits to monitor the annotation quality: multi-annotator analysis and pairwise annotators comparison.

  • Start the interface: run python YEDDA_Admin.py
  • Multi-Annotator Analysis: press button Multi-Annotator Analysis and select multiple annotated *.ann files, it will give f-measure matrix among all annotators. The result matrix is shown below:

alt text

  • Pairwise Annotators Comparison: press button Pairwise Comparison and select two annotated *.ann files, it will generate a specific comparison report (in .tex format, can be compiled as .pdf file). The demo pdf file is shown below:

alt text

Important features:

  1. Type ctrl + z will undo the most recent modification
  2. Put cursor within an entity span, press shortcut key (e.g. x) to update label (binded with x) of the entity where cursor is belonging. (q for remove the label)
  3. Selected the annotated text, such as [@美国#Location*], then press q, the annotated text will be recoverd to unannotate format (i.e. "美国").
  4. Change label directly, select entity content or put cursor inside the entity span (such as [@美国#Location*]), then press x, the annotated text will change to new label mapped with shortcut x (e.g. [@美国#Organization*]).
  5. Confirm or remove recommended entity: put cursor inside of the entity span and press y (yes) or q (quit).
  6. In the command entry, just type Enter without any command, the cursor in text will move to the head of next line. (You can monitor this through "Cursor").
  7. The "Cursor" shows the current cursor position in text widget, with row and col represent the row and column number, respectively.
  8. Export button will export the ".ann" file as a identity name with ".anns" in the same directory. The exported file list the content in sequence format. In the source code, there is a flag self.seged which controls the exported bahaviour. a). If your sentences are consist of words seperated with space (e.g. segmentated Chinese and English), then you may set self.seged=True. b). If your sentences are consist of characters without space (e.g. unsegmentated Chinese text), set self.seged=False. Another flag self.tagScheme controls the exporting format, the exported ".anns" will use the BMES format if this flag is set to "BMES", otherwise the exported file is formatted as "BIO".

Cite:

If you use YEDDA for research, please cite our ACL paper as follows:

@article{yang2017yedda,  
 title={YEDDA: A Lightweight Collaborative Text Span Annotation Tool},  
 author={Yang, Jie and Zhang, Yue and Li, Linwei and Li, Xingxuan},  
 booktitle={Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics},
 url={http://aclweb.org/anthology/P18-4006},
 year={2018}  
} 

Updating...

  • 2022-Apr-20, Move to Python 3 with colorful entity background. Thanks @etern
  • 2019-Jul-31, Convert the config file into JSON format.
  • 2018-Oct-20, YEDDA has a slight update in which shortcut maps can be edited, stored and switched seamlessly.
  • 2018-May-07, Repository is renamed as YEDDA now!
  • 2018-May-01, Our paper has been accepted as a demonstration at ACL 2018.
  • 2017-Sep-27, (YEDDA V 1.0): project was officially named as YEDDA ! See our paper here.
  • 2017-June-24, (V 0.6): support nested coloring; add event annotation beta version Event_beta.py
  • 2017-May-31, (V 0.6): optimize for Windows OS.
  • 2017-Apr-26, (V 0.5.3): fix bug with line merge when change entity type.
  • 2017-Apr-20, (V 0.5.2): fix bugs with newline problem on MacOS/Linux/Windows. (\r \n \r\n)
  • 2017-Apr-20, (V 0.5.1): change entity label more directly; optimize cursor figure.
  • 2017-Apr-19, (V 0.5): update entity represent as [@Entity#Type*]; support change label directly; fix some bugs.
  • 2017-Apr-15, (V 0.4): update example and readme.
  • 2017-Apr-13, (V 0.4): modify color; support setting color single line or whole file (may be slow in large file) (self.colorAllChunk).
  • 2017-Apr-12, (V 0.4): support BMES/BIO export (self.tagScheme); support segmented sentence export(self.seged); can save previous shortcut setting.
  • 2016-Mar-01, (V 0.3): fix export bug (bug: set space when sentence didn't include any effective label).
  • 2016-Jan-11, (V 0.2): add sequence format export function.
  • 2016-Jan-09, (V 0.1): init version.

yedda's People

Contributors

etern avatar freeshman avatar jiesutd avatar palin2018 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yedda's Issues

program get no response for large txt

I open a 6MB Chinese txt file .I got no response when a use shortcuts key like 'a' in the 'EMOn' mode.
if i am in 'RMOff' mode, it is ok.
so do you have any solutions if i do not want to split the big file ?
thanks!

导入中文text无法运行

event: A
Command:a
Exception in Tkinter callback
Traceback (most recent call last):
File "D:\python\Anaconda\envs\tenvf\lib\tkinter_init_.py", line 1705, in call
return self.func(*args)
File "D:/python/workspace/YEDDA-master/YEDDA.py", line 313, in textReturnEnter
self.executeCursorCommand(press_key.lower())
File "D:/python/workspace/YEDDA-master/YEDDA.py", line 381, in executeCursorCommand
self.writeFile(self.fileName, content, cursor_index)
File "D:/python/workspace/YEDDA-master/YEDDA.py", line 523, in writeFile
self.autoLoadNewFile(new_name, newcursor_index)
File "D:/python/workspace/YEDDA-master/YEDDA.py", line 542, in autoLoadNewFile
text = self.readFile(fileName)
File "D:/python/workspace/YEDDA-master/YEDDA.py", line 262, in readFile
text = f.read()
File "D:\python\Anaconda\envs\tenvf\lib\codecs.py", line 321, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xbe in position 0: invalid start byte
delete insert: 1.1
A

Shortcut doesn't work

Hi, Thanks for your nice work!
(PS, when I imported a Chinese document, I got an error UnicodeDecodeError: 'gbk' codec can't decode byte.., I changed f = open(filename, "r",encoding="UTF-8") instead of f = open(filename, "r". Then it works )
Following the annotation on the README. First, I put the cursor within an entity "机器" span, press shortcut key 'I'
However, the contents(Chinese) of the imported file disappear and I got an error as follows, and have no idea to deal with it.

image


F:\githubZoon\YEDDA-master>python YEDDA.py
SUTDAnnotator launched!
OS:Windows
event: i
Command:i
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\tkinter_init_.py", line 1699, in call
return self.func(*args)
File "YEDDA.py", line 313, in textReturnEnter
self.executeCursorCommand(press_key.lower())
File "YEDDA.py", line 381, in executeCursorCommand
self.writeFile(self.fileName, content, cursor_index)
File "YEDDA.py", line 523, in writeFile
self.autoLoadNewFile(new_name, newcursor_index)
File "YEDDA.py", line 542, in autoLoadNewFile
text = self.readFile(fileName)
File "YEDDA.py", line 262, in readFile
text = f.read()
File "C:\ProgramData\Anaconda3\lib\codecs.py", line 321, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xbb in position 2: invalid start byte
delete insert: 1.1
i

Could you please tell me what part of the process went wrong? and how to fix it?
I am very pleased to hear from you on the question's comments.

[Suggestion] Add export settings as buttons on GUI

Hi jiesutd, thank you for building this wonderful tool! A little suggestion here: could you add export settings as some buttons on the GUI so that users don't need to go inside the code, modify it then rerun the program? I think that way it would be more user-friendly.

GUI render weird on windows

Hi,

I'd like to try this project, but gui is wired, looks like some resolution error:
image

OS: win7 x64
Resolution settings:
image

Shortcuts don't work

Following the steps to use it but the shortcuts don't work. Using python 2.7 on Ubuntu 16.04.

python3

why not consider compatible with python3?

期待添加实体关系标注功能

这个工具还是比较轻量级,用起来也挺方便的。可惜就是还不支持实体关系标注(只找到了实体标注和事件抽取),请问后续考虑开发实体关系标注功能吗?~

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc1 in position 14: invalid start byte

when I add a new txt, it was wrong like this:

Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\86152\AppData\Local\Programs\Python\Python39\lib\tkinter_init_.py", line 1885, in call
return self.func(*args)
File "C:\Users\86152\Desktop\YEDDA-py3\YEDDA.py", line 251, in onOpen
text = self.readFile(fl)
File "C:\Users\86152\Desktop\YEDDA-py3\YEDDA.py", line 262, in readFile
text = f.read()
File "C:\Users\86152\AppData\Local\Programs\Python\Python39\lib\codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc1 in position 14: invalid start byte

how can I solve the problem?

RMon开关

在标注时一击多中可能会出现问题,RMon开关可以实现只对当前最新标注的字段有效吗?

The shortcut key "q" and "ctrl+z" is invalid

Hi, Thanks for your nice work!
Following the annotation on the README. First, I tagged an entity "机器", pressed shortcut key 'q'. The entity was deleted. Then, I pressed "ctrl + z", the full text of the imported file disappear and I got an error as follows, and have no idea to deal with it.
image
image

Could you please tell me what part of the process went wrong? and how to fix it?
I am very pleased to hear from you on the question's comments.

Malayalam Unicode rendering issue

Hello....
When i trie to open malayalam unicode file in text widget it shows rendering problem. Could you please help me to reslove this issue in YEDDA?

original file and output are attached here...

Screenshot from 2019-08-30 10:46:33
Screenshot from 2019-08-30 10:46:19

limits?

Is there a limit to the number of sentences in the input file? I have a file with 18948 sentences delimited by newlines but in the UI the file seems to end at 3524 sentences.

python YEDDA.py失败

第一次python YEDDA.py成功,X掉关闭后,再次python YEDDA.py 就报错,是线程或端口占用吗?
YEDDA launched!
OS: Windows
Traceback (most recent call last):
File "YEDDA.py", line 840, in
main()
File "YEDDA.py", line 834, in main
app = Application(root)
File "YEDDA.py", line 254, in init
self.readConfig()
File "YEDDA.py", line 273, in readConfig
config_dict = json.load(fp)
File "F:\anaconda\lib\json_init_.py", line 293, in load
return loads(fp.read(),
File "F:\anaconda\lib\json_init_.py", line 357, in loads
return _default_decoder.decode(s)
File "F:\anaconda\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "F:\anaconda\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

修改标注标签名之后启动报错,default.config不支持中文字符?

File "C:/Users/NUC/Downloads/YEDDA-master/YEDDA-master/YEDDA.py", line 834, in main
app = Application(root)
File "C:/Users/NUC/Downloads/YEDDA-master/YEDDA-master/YEDDA.py", line 254, in init
self.readConfig()
File "C:/Users/NUC/Downloads/YEDDA-master/YEDDA-master/YEDDA.py", line 273, in readConfig
config_dict = json.load(fp)
File "C:\Users\NUC\AppData\Local\Programs\Python\Python39\lib\json_init_.py", line 293, in load
return loads(fp.read(),
UnicodeDecodeError: 'gbk' codec can't decode byte 0xa1 in position 15: illegal multibyte sequence

点赞

不行了,抑制不足点赞之心,拉下来就能跑,满足各种需求,配置方便易改,完美

缺少按钮

image
你好,请问为什么我打开的界面少了RMOn和RMOff还有Exit这些按钮呀。是要修改什么东西吗。

Cannot recognize and recommend entities right before a newline character

I think in utils/recommend.py, the "## forward maximum matching (FMM)" part, the third condition should change to

elif entity_recognized_list[FMM_end] != 0:

i.e. remove the second part

decode_origin[FMM_end] == '\n'

otherwise, when FMM_end equals the end of a line, decode_origin[FMM_end] is a newline character, then FMM_end will be moved one character backward, which will then make decode_origin[FMM_start:FMM_end] a non-word.

A little suggestion

Since Chinese tokenizer would not be 100% correct, there may be some wrong word in text.
It would be nice if able to switch between text edit mode and annotator mode. Then one can simply fix the tokenizer error and continue.

报错

在YEDDA.PY运用快捷键进行标注时会报错:global name "maximum_matching" is not define

Pairwise Annotators Comparison

According to the demotext/UserA.ann and demotext/UserB.ann provided, using the Pairwise Annotators Comparison function, there will be errors or PDF documents can not be opened.
image

Windows 10 System、python2.7.15

Unable to select config on m1 Mac

~/src/YEDDA$ git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

~/src/YEDDA$ python --version
Python 3.8.10

~/src/YEDDA$ python YEDDA.py
YEDDA launched!
OS: Darwin
DEPRECATION WARNING: The system version of Tk is deprecated and may be removed in a future release. Please don't rely on it. Set TK_SILENCE_DEPRECATION=1 to suppress this warning.

I see a window with just 3 options: Recommend, Show Tags, and Colorful, of which the last one is unselected. I see no way to select a config or open a text file. Has the interface changed since Python 2.7? Is there a shortcut key to move past this screen?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.