# Entity Relations / Part of Speech Tagging

## Setup the Dataset

Navigate to [udt.dev](https://udt.dev) and click "New File"

![Click "New File" on udt.dev](https://708390366-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MFuZsfsLW71orr4EXRY%2F-MI1-I35x0iE2R-GuGoG%2F-MI11H2GNT530d7n2r1Q%2Fimage.png?alt=media\&token=8438ff28-e06e-4025-86ab-0be4818a2730)

Then select the Text Entity Relations button from the `Setup > Data Type` page.

![Select Text Relations when choosing an interface](https://708390366-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MFuZsfsLW71orr4EXRY%2F-MI5xmI5P1vIVEHqJPCX%2F-MI5yZO_K24uUxEykcwf%2Fimage.png?alt=media\&token=bc028732-3396-4c41-abdd-e04362301516)

You can now configure the interface you'd like for you Text Entity Relations dataset by adding any labels you'd like to display per sample.

![Text Entity Relation Configuration](https://708390366-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MFuZsfsLW71orr4EXRY%2F-MIFWsdNMNuazTv383PO%2F-MIFcVB12LBF9awB5auV%2Fimage.png?alt=media\&token=d292bb01-87cf-4766-b632-04ba61a5de37)

## Import Data

You can use any of the following methods to import text data.

* [Import Text Snippets](https://docs.universaldatatool.com/importing-data/import-text-snippets)
* [Import from CSV or JSON](https://docs.universaldatatool.com/importing-data/import-from-csv-or-json)

## Label your Data (with friends!)

Go to the `Label` tab to begin labeling data. See the [Collaborative Labeling Guide](https://docs.universaldatatool.com/collaborative-labeling) to label with friends or a team of your labelers.

![Example of Text Entity Relations labeling](https://708390366-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MFuZsfsLW71orr4EXRY%2F-MIFWsdNMNuazTv383PO%2F-MIFcEbcT2Cr0trAMY5Q%2Fimage.png?alt=media\&token=7fc8c8d0-4fd7-4678-8fdc-120b6923b0a0)

## Export and Use

The easiest way to use a Entity Relations dataset is using the JSON format. Use the "Download JSON" button at the top when you're done labeling and check out the [Text Entity Relations JSON Specification](https://github.com/UniversalDataTool/udt-format/blob/master/interfaces/text_entity_relations.md).

Here's what a JSON sample looks like in the resultant dataset:

```javascript
{
  "document": "This strainer makes a great hat, I'll wear it while I serve spaghetti!",
  "annotation": {
    "entities": [
      {
        "text": "strainer",
        "label": "hat",
        "start": 5,
        "end": 13,
        "textId": "id1"
      },
      {
        "text": "spaghetti",
        "label": "food",
        "start": 60,
        "end": 69,
        "textId": "id2"
      },
      {
        "text": "I'll",
        "start": 33,
        "end": 37,
        "textId": "id3"
      },
      {
        "text": "wear",
        "start": 38,
        "end": 42,
        "textId": "id4"
      }
    ],
    "relations": [
      {
        "from": "id3",
        "to": "id4",
        "label": "subject-doing"
      }
    ]
  }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.universaldatatool.com/building-and-labeling-datasets/entity-relations-part-of-speech-tagging.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
