logofirst
logofirst GitHub

HyperText

The HyperText tag displays hypertext markup for labeling. Use for labeling HTML-encoded text and webpages for NER and NLP projects.

Use with the following data types: HTML

Parameters

Param Type Default Description
name string Name of the element
value string Value of the element
[valueType] url | text text Whether the text is stored directly in uploaded data or needs to be loaded from a URL
[inline] boolean false Whether to embed HTML directly in Label Studio or use an iframe
[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
[clickableLinks] boolean false Whether to allow opening resources from links in the hypertext markup.
[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 xpath of the container where the region starts (xpath)
value.end string xpath of the container where the region ends (xpath)
value.startOffset number offset within start container
value.endOffset number offset within end container
[value.text] string text content of the region, can be skipped

Example JSON

{
  "value": {
    "start": "/div[1]/p[2]/text()[1]",
    "end": "/div[1]/p[4]/text()[3]",
    "startOffset": 2,
    "endOffset": 81,
    "hypertextlabels": ["Car"]
  }
}

Example

<!--Labeling configuration to label HTML content -->
<View>
  <HyperText name="text-1" value="$text" />
  <Labels name="parts" toName="text-1">
    <Label value="Caption" />
    <Label value="Article" />
    <Label value="Author" />
  </Labels>
</View>

Example

<View>
  <HyperText name="p1">
    <p>Some explanations <em>with style</em></p>
  </HyperText>
</View>