NEW OpenAI Structured Outputs with Label Studio 🚀

Text

The Text tag shows text that can be labeled. Use to display any type of text on the labeling interface. You can use <Style>.htx-text{ white-space: pre-wrap; }</Style> to preserve all spaces in the text, otherwise spaces are trimmed when displayed and saved in the results. Every space in the text sample is counted when calculating result offsets, for example for NER labeling tasks.

Use with the following data types: text.

How to read my text files in python?

The Label Studio editor counts \r\n as two different symbols, displaying them as \n\n, making it look like there is extra margin between lines. You should either preprocess your files to replace \r\n with \n completely, or open files in Python with newline='' to avoid converting \r\n to \n: with open('my-file.txt', encoding='utf-8', newline='') as f: text = f.read() This is especially important when you are doing span NER labeling and need to get the correct offsets: text[start_offset:end_offset]

Parameters

Param Type Default Description
name string Name of the element
value string Data field containing text or a UR
[valueType] url | text text Whether the text is stored directly in uploaded data or needs to be loaded from a URL
[saveTextResult] yes | no Whether to store labeled text along with the results. By default, doesn’t store text for valueType=url
[encoding] none | base64 | base64unicode How to decode values from encoded strings
[selectionEnabled] boolean true Enable or disable selection
[highlightColor] string Hex string with highlight color, if not provided uses the labels color
[showLabels] boolean Whether or not to show labels next to the region; unset (by default) — use editor settings; true/false — override settings
[granularity] symbol | word | sentence | paragraph Control region selection granularity

Sample Results JSON

Name Type Description
value Object
value.start string position of the start of the region in characters
value.end string position of the end of the region in characters
[value.text] string text content of the region, can be skipped

Example JSON

{
  "value": {
    "start": 2,
    "end": 81,
    "labels": ["Car"]
  }
}

Example

Labeling configuration to label text for NER tasks with a word-level granularity

<View>
  <Text name="text-1" value="$text" granularity="word" highlightColor="#ff0000" />
  <Labels name="ner" toName="text-1">
    <Label value="Person" />
    <Label value="Location" />
  </Labels>
</View>

Example

<Text name="p1">Some simple text with explanations</Text>