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 Select
Icon select_icon
Quantity 1

Procedure

Create a random selection or sample of segments with an instance of Select

Figure 1: Create a random selection or sample of segments with an instance of Select

  1. Create an instance of Select on the canvas.
  2. Drag and drop from the output connection (righthand side) of the widget instance that emits the segmentation to be sampled (e.g. an instance of Segment) to the Select instance’s input connection (lefthand side).
  3. Open the Select instance’s interface by double-clicking on its icon on the canvas.
  4. Tick the Advanced settings checkbox.
  5. In the Select section, choose the Method: Sample.
  6. 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).
  7. 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).
  8. Click the Send button (or make sure the Send automatically checkbox is selected).
  9. A segmentation containing the sampled segments is then available on the Select instance’s output connections; 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.