> For the complete documentation index, see [llms.txt](https://docs.unitlab.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.unitlab.ai/documentation/annotations/text-annotation.md). Agents can also search and read this documentation through its [MCP server](https://docs.unitlab.ai/~gitbook/mcp).

# Text Annotation

Label entities, relations, sentiment, and translations in text files, and set the ontology for each use case.

Highlight words in a text file and give them a class. Add properties to a span, connect spans with relations, and use Item properties for facts about the whole file.

![A robot service ticket with entities, relation lines, and the Objects list](https://292810646-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGjVLUz4wthGkGlRKM6rM%2Fuploads%2FoMKMhmy0zvPZIhmrKLIm%2Fta-text-ner-relations.webp?alt=media)

## What you can build

The ontology decides the use case. The same editor covers all of these:

| Use case                       | Ontology you need                        | Example below         |
| ------------------------------ | ---------------------------------------- | --------------------- |
| Named entity recognition (NER) | One class per entity type                | Robot service tickets |
| Relation extraction            | Entity classes plus relation types       | Robot service tickets |
| Text classification            | Item properties (single or multi-select) | Robot feedback        |
| Aspect-based sentiment         | A span class with a polarity property    | Robot feedback        |
| Translation and paraphrase     | A span class with a text property        | Safety instructions   |

## The text editor

| Control                          | What it does                                                       | Shortcut                     |
| -------------------------------- | ------------------------------------------------------------------ | ---------------------------- |
| **Class chips** (above the text) | Pick the class for the next span.                                  | `Shift` + `C` cycles classes |
| **Pan Mode**                     | Read and select spans without creating new ones.                   | `V`                          |
| **Entity Mode**                  | Drag across words to create a span.                                | `T`                          |
| **Relation Mode**                | Click a source span, then a target span, to link them.             | `R`                          |
| **Comment**                      | Pin a comment to a place in the text.                              | `C`                          |
| **Aa**                           | Change the font size of the passage.                               |                              |
| **Objects** list                 | Every span, its properties and relations, and **Item properties**. |                              |

## Use case: entities and relations in service tickets

A robotics team extracts structured repair data from free-text service tickets. Each ticket names a robot, the failing component, a fault code, the symptom, and the repair.

**Ontology**

| Element        | Setting                                                                                                    |
| -------------- | ---------------------------------------------------------------------------------------------------------- |
| Entity classes | Robot, Component, Fault code, Symptom, Repair action, Part number                                          |
| Relation types | has fault (Robot to Fault code), located on (Symptom to Component), fixed by (Fault code to Repair action) |
| Item property  | Severity: Low, Medium, High                                                                                |

{% stepper %}
{% step %}

### Label the entities

Press `T`, choose **Robot** in the class chips, and drag across **AMR-12**. Repeat for each mention. Leave out spaces and the punctuation around a mention.
{% endstep %}

{% step %}

### Connect related spans

Press `R`, click **AMR-12**, then click **E-217**. A line joins the two spans, labeled with the relation type. You can also open a span in the **Objects** list and choose **Add relation**.
{% endstep %}

{% step %}

### Classify the ticket

In the **Objects** list, expand **Item properties** and set **Severity**.
{% endstep %}
{% endstepper %}

{% hint style="info" %}
Spans cannot overlap. When two meanings share words, label the longer phrase (for example **replaced the caster wheel** as a Repair action) and keep the shorter one for the next mention.
{% endhint %}

## Use case: aspect sentiment and text classification

Operators write short feedback after each robot shift. The team wants the sentiment of each aspect, an overall sentiment, and the topics a note covers.

**Ontology**

| Element       | Setting                                                                    |
| ------------- | -------------------------------------------------------------------------- |
| Span class    | Aspect, with a required **Polarity** property: Positive, Neutral, Negative |
| Item property | Overall sentiment (single select): Positive, Neutral, Negative, Mixed      |
| Item property | Topics (multi-select): Navigation, Battery, Safety, Usability, Throughput  |

![Aspect spans with Polarity badges, and Overall sentiment and Topics in Item properties](https://292810646-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGjVLUz4wthGkGlRKM6rM%2Fuploads%2F9EkfmAQ7vR7oclyKi5EG%2Fta-text-sentiment-item-props.webp?alt=media)

1. Label each opinion phrase as **Aspect**. The editor asks for **Polarity**, and the value shows as a badge on the span.
2. Expand **Item properties** and choose one **Overall sentiment**. A note with praise and complaints is **Mixed**.
3. Tick every matching **Topic**.
4. Press `→` to open the next file.

For classification without spans, use only the item properties. Each file then gets one label set.

## Use case: sentence translation

A Spanish safety sheet for a robot cell needs a reviewed English version, aligned sentence by sentence.

**Ontology**

| Element         | Setting                                                         |
| --------------- | --------------------------------------------------------------- |
| Span class      | Sentence, with a required text property **English translation** |
| Item properties | Source language, Translation status (Draft, Reviewed)           |

![A selected Spanish sentence with its English translation open for editing](https://292810646-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGjVLUz4wthGkGlRKM6rM%2Fuploads%2FGn6dUhy0T3mVxwC499ip%2Fta-text-translation-sentence.webp?alt=media)

1. Label each source sentence as **Sentence**.
2. In the **Objects** list, click the property under the sentence. The **English translation** box opens. Type the translation.
3. Each span shows the start of its translation as a badge, so you can scan for missing ones.
4. Set **Translation status** to **Reviewed** when every sentence is done.

The same setup works for paraphrase, normalization, or summaries: rename the text property.

## Tips

* Agree on boundary rules before you start: titles, units, and trailing punctuation.
* Use a property for a value that changes per mention (polarity, severity). Use a new class only when the type itself differs.
* Put facts about the whole file in **Item properties**, not on a span.
* Text annotation is manual. Smart tools such as auto-labeling apply to images, video, and other visual data.

<details>

<summary>Watch the text editor in use</summary>

{% embed url="<https://homepage-files.s3.us-east-2.amazonaws.com/hero-videos/hero/text-annotation-1.mp4>" %}

</details>

## Related

[Properties, relations, and Item Properties](https://docs.unitlab.ai/documentation/ontologies/properties-relations-and-item-properties.md) · [HTML](https://docs.unitlab.ai/documentation/annotations/html-annotation.md) · [Tabular](https://docs.unitlab.ai/documentation/annotations/tabular-annotation.md) · [Audio Annotation](https://docs.unitlab.ai/documentation/annotations/audio-annotation.md)
