Count transition frequency between adjacent units


Count the frequency of transitions between adjacent segment types in a text.


Some text has been imported in Orange Textable (see Cookbook: Text input) and it has been segmented in smaller units (see Cookbook: Segment text in smaller units).


Widget Count
Icon count_icon
Quantity 1


Count frequency of adjacent contexts with an instance of Count

Figure 1: Count transition frequency with an instance of Count

  1. Create an instance of Count on the canvas.
  2. Drag and drop from the output connection (righthand side) of the widget instance that has been used to segment the text (e.g. Segment) to the Count widget instance’s input connection (lefthand side).
  3. Open the Count instance’s interface by double-clicking on its icon on the canvas.
  4. In the Units section, select the segmentation in which transitions between units will be counted.
  5. In the Context section, choose Mode: Left-right neighborhood.
  6. Select Left context size: 1 and Right context size: 0.
  7. Click the Compute button (or make sure the Compute automatically checkbox is selected).
  8. A table showing the results is then available at the output connection of the Count instance; to display or export it, see Cookbook: Table output.


  • It is also possible to define units as segment pairs (bigrams), triples (trigrams), and so on, by increasing the Sequence length parameter in the Units section.
  • If Sequence length is set to a value greater than 1, the string appearing in the Intra-sequence delimiter field will be inserted between the elements composing each n-gram in the column headers, which can enhance their readability. The default is # but you can change it by inserting the delimiter of your choice.
  • Furthermore, it is possible to count the apparition of units in more complex contexts than simply the previous unit, such as: the n previous units (Left context size); the n following units (Right context size); or any combination of both.
  • The Unit position marker is a string that indicates the separation between left and right contexts sides. The default is _ but you can change it by inserting the marker of your choice.