# Text Annotation

## Text annotation for NLP and document processing: a complete guide

Text annotation is widely used in organisations to solve NLP tasks for machine learning models. Learn more about text annotation in machine learning and how to employ the tool for better productivity!

### What is Text Annotation in Machine Learning? <a href="#id-1" id="id-1"></a>

Simply put, text annotation in machine learning (ML) is the process of assigning labels to a digital file or document and its content. Labeling a text can consist in assigning tags to text attributes such as keywords, sentences, and paragraphs or simply classifying the text based on its content (i.e. text classification).

These include various NLP technologies like neural machine translation (NMT) programs, auto Q\&A (question and answer) platforms, smart chatbots, sentiment analysis, text-to-speech synthesizers, and auto speech recognition (ASR) tools, among other related projects. These technologies can streamline the activities and transactions of many organizations across different industries.

If you want to learn more about the history of NLP in computer science, you can read [our article](https://kili-technology.com/data-labeling/nlp/learn-more-about-deep-learning-and-natural-language-processing) here.

### &#x20;What are the different types of text annotations?

#### Text / Document classification <a href="#id-9" id="id-9"></a>

Text and document classification consists in attributing one or multiple attributes to a single text or full document.

Examples:

1. 1\. Classifying emails as spam or regular emails
2. 2\. Doing sentiment analysis on tweets
3. 3\. Labeling legal documents based on their content (legal notices, agreements, bonds, …)

![example-of-sentiment-analysis-from-an-amazon-review](https://a.storyblok.com/f/139616/2880x284/6cb1764a01/example-of-sentiment-analysis-from-an-amazon-review.webp)

Example of sentiment analysis on an amazon review

![ladding-bill-being-classified](https://a.storyblok.com/f/139616/2880x1548/b883ee1a61/ladding-bill-being-classified.webp)

Bill of lading being classified

#### &#x20;Named entity recognition <a href="#id-28" id="id-28"></a>

At a high level, named entity recognition is the action of identifying named entities within a text and assigning it a predefined category. Common categories that are used for this type of text annotation include names of organizations, locations, persons, numerical values, month or time and day of the week, etc. But depending on the type of NER performed, categories such as paragraph, title, and content can also be used.

![NER-performed-on-an-article-from-Reuters](https://a.storyblok.com/f/139616/2274x512/b20ab73b2f/ner-performed-on-an-article-from-reuters.webp)

NER performed on a short article from Reuters

#### &#x20;Entity linking <a href="#id-34" id="id-34"></a>

This is the process for linking entities to better understand the structure of the text and the relationships between entities. Here you can see a table being extracted from a scanned invoice and item lines being linked together to preserve its structure.\
\
![table-extracted-from-scanned-document](https://a.storyblok.com/f/139616/2880x1550/25493c3a02/table-extracted-from-scanned-document.webp)

A table being extracted from scanned document

![KYC-use-case-entity-extraction-use-case](https://a.storyblok.com/f/139616/2880x1550/66fbf0381b/kyc-use-case-entity-extraction-use-case.webp)

A table being extracted from scanned document

#### &#x20;Layout analysis <a href="#id-44" id="id-44"></a>

Layout analysis consists of labeling document structures to transform them into another format (ex: JSON).

![document-layout-being-extracted](https://a.storyblok.com/f/139616/2880x1548/5ba4dfd0f1/document-layout-being-extracted.webp)

Layout analysis consists of labeling document structures to transform them into another format (ex: JSON).

\


### How to label texts, PDFs, and Images? <a href="#how-to-label-texts-pdfs-and-images" id="how-to-label-texts-pdfs-and-images"></a>

In real life, textual data exists under a wide range of different formats txt, pdf or even text in images or scanned documents. In this part are going to dive deep into the specificities of those data formats and what features are mandatory to label efficiently.

### Labeling text data <a href="#labeling-text-data" id="labeling-text-data"></a>

When labeling text data in simple txt format, the following features are important:

#### Multilingual Support <a href="#id-56" id="id-56"></a>

When labeling textual data, language and tokenization are key to consider. The labeling tool used must allow the labeling of all languages. Using Kili, you can natively label any language using our interfaces.\
![annotation-on-english-speaking-document](https://a.storyblok.com/f/139616/2880x1548/e407a81a58/annotation-on-english-speaking-document.webp)

Annotated English Document

![annotation-on-arab-speaking-document](https://a.storyblok.com/f/139616/2880x1554/77fac65e4d/annotation-on-arab-speaking-document.webp)

Annotated Arabic Document

![annotation-on-mandarin-speaking-document](https://a.storyblok.com/f/139616/2880x1548/86bc1c1140/annotation-on-mandarin-speaking-document.webp)

Annotated Chinese-speaking Document
