Skip to content
This repository was archived by the owner on Apr 18, 2024. It is now read-only.

Commit 5f01a6f

Browse files
hlomziksmoreface
andauthored
Update docs for HyperText/Text via stub files (#403)
* Update docs for HyperText/Text via stub files * fix `inline` param jsdoc Co-authored-by: smoreface <[email protected]> * fix BrushRegion docs to be the same as in master Co-authored-by: smoreface <[email protected]>
1 parent db308c9 commit 5f01a6f

File tree

6 files changed

+113
-0
lines changed

6 files changed

+113
-0
lines changed

src/regions/HyperTextRegion.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// stub file to keep HyperTextRegion docs
2+
3+
/**
4+
* @example
5+
* {
6+
* "value": {
7+
* "start": "/div[1]/p[2]/text()[1]",
8+
* "end": "/div[1]/p[4]/text()[3]",
9+
* "startOffset": 2,
10+
* "endOffset": 81,
11+
* "hypertextlabels": ["Car"]
12+
* }
13+
* }
14+
* @typedef {Object} HyperTextRegionResult
15+
* @property {Object} value
16+
* @property {string} value.start xpath of the container where the region starts (xpath)
17+
* @property {string} value.end xpath of the container where the region ends (xpath)
18+
* @property {number} value.startOffset offset within start container
19+
* @property {number} value.endOffset offset within end container
20+
* @property {string} [value.text] text content of the region, can be skipped
21+
*/

src/regions/TextRegion.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// stub file to keep TextRegion docs
2+
3+
/**
4+
* @example
5+
* {
6+
* "value": {
7+
* "start": 2,
8+
* "end": 81,
9+
* "labels": ["Car"]
10+
* }
11+
* }
12+
* @typedef {Object} TextRegionResult
13+
* @property {Object} value
14+
* @property {string} value.start position of the start of the region in characters
15+
* @property {string} value.end position of the end of the region in characters
16+
* @property {string} [value.text] text content of the region, can be skipped
17+
*/

src/tags/object/HyperText.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// stub file to keep docs for HyperText object tag
2+
3+
/**
4+
* The HyperText tag displays hypertext markup for labeling. Use for labeling HTML-encoded text and webpages for NER and NLP projects.
5+
*
6+
* Use with the following data types: HTML
7+
* @example
8+
* <!--Labeling configuration to label HTML content -->
9+
* <View>
10+
* <HyperText name="text-1" value="$text" />
11+
* <Labels name="parts" toName="text-1">
12+
* <Label value="Caption" />
13+
* <Label value="Article" />
14+
* <Label value="Author" />
15+
* </Labels>
16+
* </View>
17+
* @example
18+
* <HyperText name="p1" value="<p>Some explanations <em>with style</em></p>" />
19+
* @name HyperText
20+
* @regions HyperTextRegion
21+
* @meta_title Hypertext Tags for Hypertext Markup (HTML)
22+
* @meta_description Label Studio Hypertext Tags customize Label Studio for hypertext markup (HTML) for machine learning and data science projects.
23+
* @param {string} name Name of the element
24+
* @param {string} value Value of the element
25+
* @param {url|text} [valueType=text] Whether the text is stored directly in uploaded data or needs to be loaded from a URL
26+
* @param {boolean} [inline=false] Whether to embed HTML directly in Label Studio or use an iframe
27+
* @param {yes|no} [saveTextResult] Whether to store labeled text along with the results. By default, doesn't store text for `valueType=url`
28+
* @param {none|base64|base64unicode} [encoding] How to decode values from encoded strings
29+
* @param {boolean} [selectionEnabled=true] Enable or disable selection
30+
* @param {boolean} [clickableLinks=false] Whether to allow opening resources from links in the hypertext markup.
31+
* @param {string} [highlightColor] Hex string with highlight color, if not provided uses the labels color
32+
* @param {boolean} [showLabels] Whether or not to show labels next to the region; unset (by default) — use editor settings; true/false — override settings
33+
* @param {symbol|word|sentence|paragraph} [granularity] Control region selection granularity
34+
*/
35+
export const HyperTextModel = {};

src/tags/object/RichText/model.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ const WARNING_MESSAGES = {
2525
};
2626

2727
/**
28+
* WARNING: this is not a real doc, that's just a main reference; real docs are in their stub files: HyperText and Text
29+
*
2830
* RichText tag shows text or HTML and allows labeling
2931
* @example
3032
* <RichText name="text-1" value="$text" granularity="symbol" highlightColor="#ff0000" />

src/tags/object/Text.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// stub file to keep docs for Text object tag
2+
3+
/**
4+
* The Text tag shows text that can be labeled. Use to display any type of text on the labeling interface.
5+
* You can use `<Style>.htx-text{ white-space: pre-wrap; }</Style>` to preserve all spaces in the text, otherwise spaces are trimmed when displayed.
6+
* Every space in the text sample is counted when calculating result offsets, for example for NER labeling tasks.
7+
*
8+
* Use with the following data types: text
9+
* @example
10+
* <!--Labeling configuration to label text for NER tasks with a word-level granularity -->
11+
* <View>
12+
* <Text name="text-1" value="$text" granularity="word" highlightColor="#ff0000" />
13+
* <Labels name="ner" toName="text-1">
14+
* <Label value="Person" />
15+
* <Label value="Location" />
16+
* </Labels>
17+
* </View>
18+
* @example
19+
* <Text name="p1">Some simple text with explanations</Text>
20+
* @name Text
21+
* @regions TextRegion
22+
* @meta_title Text Tags for Text Objects
23+
* @meta_description Customize Label Studio with the Text tag to annotate text for NLP and NER machine learning and data science projects.
24+
* @param {string} name Name of the element
25+
* @param {string} value Data field containing text or a UR
26+
* @param {url|text} [valueType=text] Whether the text is stored directly in uploaded data or needs to be loaded from a URL
27+
* @param {yes|no} [saveTextResult] Whether to store labeled text along with the results. By default, doesn't store text for `valueType=url`
28+
* @param {none|base64|base64unicode} [encoding] How to decode values from encoded strings
29+
* @param {boolean} [selectionEnabled=true] Enable or disable selection
30+
* @param {string} [highlightColor] Hex string with highlight color, if not provided uses the labels color
31+
* @param {boolean} [showLabels] Whether or not to show labels next to the region; unset (by default) — use editor settings; true/false — override settings
32+
* @param {symbol|word|sentence|paragraph} [granularity] Control region selection granularity
33+
*/
34+
export const TextModel = {};

src/tags/object/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,8 @@ import { TimeSeriesModel } from "./TimeSeries";
66
import { ParagraphsModel } from "./Paragraphs";
77
import { VideoModel } from "./Video";
88

9+
// stub files to keep docs of these tags
10+
import "./HyperText";
11+
import "./Text";
12+
913
export { AudioModel, AudioPlusModel, ImageModel, ParagraphsModel, TimeSeriesModel, RichTextModel, VideoModel };

0 commit comments

Comments
 (0)