d5555 / TagEditor

🏖TagEditor - Annotation tool for spaCy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TagEditor(v3.4.1) annotation tool

TagEditor is a desktop application (requires Windows 10, 64-bit) that allows you to quickly annotate text with the help of spaCy library.
With TagEditor you can annotate dependencies, parts of speech, Named entities, text categories and Coreference resolution, create your customized annotated data or create a training dataset in formats .json or .spacy for training with spaCy library or pytorch.

Installation

No installation required.
Download and unpack TagEditor.7z
Run 'TagEditor.exe' in the main folder.

Demo

alt text

Usage

  Insert your text or open a text file and press Start tagging (or choose one of the options in Menu/Tools). Choose type of annotation and labels like in the screenshot below and press Ok. Or you can start with loading your datasets in formats .spacy or .json.

alt text
Select a tag in TAG SET pannel then select a word to assign the tag. Select a head tag to assign dependency if you are working in the Dependencies window .
  To edit Doc or Tokens - use Right-click on any word. Context menu allows to edit, delete, insert words or sentences, also merge or split sentences. To merge sentences right-click on the first word of sentence. It is checked as Sentence start. Uncheck it and the sentence will merge with the previous sentence.

  To assign new paragraph use context menu or click on the sentence number on the left side. Or use button Assign paragraphs in the tab Words to assign paragraphs after new line symbols '\n' in text.
  To delete all newline characters and extra whitespaces in the text, select the tab Words and press Remove Whitespaces. All Sentence starts are highlighted with rose color and whitespaces - with yellow color.

Press button Create DATA to create training data in "simple training style" or JSON. You can save it in text, json or spacy format ...
Save project for future editing. Load project to continue where you left.
Also you can save and load your datasets in formats .spacy or .json.

If you don't have a pretrained model for a given language, select language from the list for proper tokenization:

Named Entities
First click on a label in the Tag Set pannel then select words in the main window that you want to assign label to. To delete assigned label just click on it in the editor window. Create output data with char/token offset or BILUO / IOB scheme. It is allowed to create nested or overlapping tags if you use char/token offset.
If the option NER search all is on and you selected a new span - selected label will be assigned to all spans found in the text accordingly.
Option --Annotate-- allows to switch models and annotate on top of your already annotated text in different modes. This way you can compare two(or more) different models or just to annotate text using several models in tandem.
TAG SET panel allows editing labels, adding new labels and their description, saving and uploading labels.

alt text

Press button Create data , select items and save as *.spacy, *.txt or *.json format or print it on the screen. if you assigned paragraphs - select Manually assigned paragraphs

alt text

POS tags
In this window you can edit POS tags (fine-grained) and also view coarse-grained pos tags and morphs.
alt text

Dependencies
Select a tag in TAG SET pannel then click on a word in the editor window to assign the tag. Click on another word(token) to assign a head tag. Click on the word again to remove the tag. alt text

Co-reference tagger
 Coreference annotation is according to PreCo 'Data Format'.
Dataset can be downloaded from here: https://github.com/d5555/Coreference-dataset
Compatible with NeuralCoref 4.0. To use NeuralCoref for annotating select "Enable NeuralCoref" after 'Start tagging'. Set parameter 'greedyness' 0,55.

https://preschool-lab.github.io/PreCo/
https://arxiv.org/abs/1810.09807
"sentences" - is a list of sentences. Each sentence is a list of tokens. Each token is a string, which can be a word or a punctuation mark.
"mention_clusters" - is a list of mention clusters. Each mention cluster is a list of mentions. Each mention is a tuple of integers [sentence_idx, begin_idx, end_idx]. Sentence_idx is the index of the sentence of the mention. Begin_idx is the index of the first token of the mention in the sentence. End_index is the index of the last token of the mention in the sentence plus one. All indices are zero-based.
  Select in the editor window a word or a span of words. It will be a singleton(single entity) with no connection to other entities and framed with dash line. Then select another span. Everytime you select an entity it is highlighted by green color frame. While it is in selected state click on another entity and they will be linked together and highligted by same color and get same coref number (a num in the right corner of frame). That simple!
To deselect just click on empty space in the main window.
To unlink a span from the entity , select it and then click on it again. It will turn into singleton. You can also use the table on the right side. If the text is long and you don't want to scroll it just click on an entity in the table to get spans linked. Entities which are not singletons are added to the table automatically. Though you can add singletons too. Entity color can be changed except for singleton.
You can load data from PreCo dataset to TagEditor directly. Unzip PreCo dataset , run tagEditor and select menu File->Load PreCO/Coref->(select file). You can test it with the file coref_example.jsonl
alt text alt text

Text Categories
https://spacy.io/api/textcategorizer
In the Text Categories you can assign labels to paragraphs, sentences or to spans (see below).
  Select the score in the TAG SET pannel - True or False(i.e 1.0 or 0.0) and select a category label. Go to the editor window and click on sentence. Category and score will be added. You can easily switch the score True/False by just clicking on the score label in editor window. Supports multiple, non-mutually exclusive labels.
Use check button Assign/unassign all to assign/unassign all labels to all sentences in one click. Then you can manually change True/False status of each label by clicking on the label or delete the label in the editor window.
For demo purporses the text classifier of this tool was trained on the IMDB dataset with labels 'POSITIVE NEGATIVE'. The partial dataset converted to spacy format can be downloaded from here:
https://github.com/d5555/textcat_dataset_IMDB

If you have a model with pretrained text classifier and want to classify paragraphs (instead of sentences or whole text), close the window Text Categories, assign paragraphs (because by default the whole text is one paragraph) and then press tools and in the tab Text Categories select Paragraph.
alt text alt text

'Spans classification mode' allows multiple overlapping labels. Can be used as an all-purporse text tagger with the data format (index of first token, index of last token+1, label name). Zero based.

To use your pretrained models with TagEditor or other spacy models, acquire the full version of TagEditor. Please contact gitprojects5@gmail.com

*You have any suggestions on improving the program, adding extra feature, feel free to leave a comment or email at gitprojects5@gmail.com