Create a random selection or sample of segments¶
Goal¶
Create a random sample of segments.
Prerequisites¶
Some text has been imported in Orange Textable (see Cookbook: Text input) and in all likelihood it has been segmented in smaller units (see Cookbook: Segment text in smaller units).
Ingredients¶
Widget
Icon
Quantity
1
Procedure¶

Figure 1: Create a random selection or sample of segments with an instance of Select¶
Create an instance of Select.
Drag and drop from the output (righthand side) of the widget that emits the segmentation to be sampled, here Segment (letters), to the input of Select (lefthand side).
Double-click on the icon of Select to open its interface.
Tick the Advanced settings checkbox.
In the Select section, choose Sample in the Method drop-down menu.
Under Sample size expressed as, choose whether you want to express sample size in terms of Count (i.e. number of tokens) or of Proportion (i.e. percentage of tokens).
In the Sample size control, choose the number of segments that will be randomly sampled (respectively, choose the percentage of segments in the Sampling rate (%) control).
Click the Send button or tick the Send automatically checkbox.
A segmentation containing the sampled segments is then available at the output of Select; to display or export it, see Cookbook: Text output.
Comment¶
The Select widget emits on a second output connection (not selected by default) a segmentation containing the segments that were not selected (see Filtering segmentations using regexes for instructions on how to access this other output segmentation).