> For the complete documentation index, see [llms.txt](https://utca.knowledgator.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://utca.knowledgator.com/tasks/relation-extraction-tasks-utilities.md).

# Relation extraction tasks utilities

***

***

## <mark style="color:green;">RelationExtractionInput</mark>

Subclass of [**IOModel**](/core/schemas.md#iomodel)**.**

***

### <mark style="color:blue;">\_\_init\_\_</mark>

#### Arguments:

* <mark style="color:orange;">**text**</mark>**&#x20;(str):** Text to process.
* <mark style="color:orange;">**relations**</mark>**&#x20;(List\[**[**Relation**](#relation)**]):** Relations parameters.
* <mark style="color:orange;">**entities**</mark>**&#x20;(List\[**[**ClassifiedEntity**](/tasks/objects.md#classifiedentity)**]):** Entities to use.

***

***

***

## <mark style="color:green;">RelationExtractionOutput</mark>

Subclass of [**IOModel**](/core/schemas.md#iomodel)**.**

***

### <mark style="color:blue;">\_\_init\_\_</mark>

#### Arguments:

* <mark style="color:orange;">**output**</mark>**&#x20;(List\[**[**Triplet**](#triplet)**]):** Relations triplets.

***

***

***

## <mark style="color:green;">Relation</mark>

***

### <mark style="color:blue;">\_\_init\_\_</mark>

#### Arguments:

* <mark style="color:orange;">**relation**</mark>**&#x20;(str):** Relation label.
* <mark style="color:orange;">**pairs\_filter**</mark>**&#x20;(Optional\[List\[Tuple\[str, str]]], optional):** Expected pairs for relation. If equals to None all pairs will be returned. Defaults to None.
* <mark style="color:orange;">**distance\_threshold**</mark>**&#x20;(int, optional):** Distance threshold. It specifies the max distance between spans in the text (i.e., the end of the span that is closer to the start of the text and the start of the next one). Defaults to -1 (no distance threshold).

***

***

***

## <mark style="color:green;">Triplet</mark>

***

### <mark style="color:blue;">\_\_init\_\_</mark>

#### Arguments:

* <mark style="color:orange;">**source**</mark>**&#x20;(**[**ClassifiedEntity**](/tasks/objects.md#classifiedentity)**):** Source entity in the relation.
* <mark style="color:orange;">**relation**</mark>**&#x20;(str):** Relation label.
* <mark style="color:orange;">**target**</mark>**&#x20;(**[**ClassifiedEntity**](/tasks/objects.md#classifiedentity)**):** Target entity in the relation.
* <mark style="color:orange;">**score**</mark>**&#x20;(float):** Relation score.

***

***
