from aligned_textgrid import SequenceInterval
sample_interval = SequenceInterval((0, 1, "sample"))
print(sample_interval)Class SequenceInterval, label: sample, .superset_class: Top, .super_instance, None, .subset_class: Bottom
sequences.sequences.SequenceInterval(self, interval=(None, None, None), *, Interval=None)
A class to describe an interval with precedence relationships and hierarchical relationships
| Name | Type | Description | Default |
|---|---|---|---|
interval |
list | tuple | Interval | Self |
A Praat textgrid Interval. This could one of: i) A list or tuple of start, end and label values (e.g. [0, 1, "foo"]); ii) A praatio.utilities.constants.Interval iii) Another SequenceInterval. In this last case, only the start, end and label values from the original SequenceInterval are preserved in the new one. |
(None, None, None) |
A new SequenceInterval can be created from scratch by passing it a tuple of a start time, end time, and a label
from aligned_textgrid import SequenceInterval
sample_interval = SequenceInterval((0, 1, "sample"))
print(sample_interval)Class SequenceInterval, label: sample, .superset_class: Top, .super_instance, None, .subset_class: Bottom
You can pass a SequenceInterval to another SequenceInterval or subclass (like Word) as well
| Name | Type | Description |
|---|---|---|
| start | float | Start time of the interval |
| end | float | End time of the interval |
| label | Any | Label of the interval |
| duration | float | The duration of the interval |
| intier | SequenceTier |
The sequence tier the current interval is within. |
| tier_index | int | The index of sequence within its tier. |
| fol | SequenceInterval | Instance of the following interval. Is the same subclass as the current instance. |
| prev | SequenceInterval | Instance of the previous interval. Is the same subclass as current instance. |
| super_instance | SequenceInterval | The instance of the superset. Cannot be the same subclass as the current instance. |
| subset_list | list[SequenceInterval] | A list of subset instances. Cannot be the same subclass of the current instance. |
| sub_starts | numpy.ndarray | A numpy array of start times for the subset list |
| sub_ends | numpy.ndarray | A numpy array of end times for the subset list |
| sub_labels | list[Any] | A list of labels from the subset list |
| Name | Description |
|---|---|
| fuse_leftwards | Fuse the current segment with the previous segment |
| fuse_rightwards | Fuse the current segment with the following segment |
| index | Returns subset instance index |
| pop | Pop a sequence interval from the subset list |
| set_feature | Sets arbitrary object attribute |
sequences.sequences.SequenceInterval.fuse_leftwards(label_fun=lambda x, y: ' '.join([x, y]))
Fuse the current segment with the previous segment
| Name | Type | Description | Default |
|---|---|---|---|
label_fun |
function |
Function for joining interval labels. | lambda x, y: ' '.join([x, y]) |
sequences.sequences.SequenceInterval.fuse_rightwards(label_fun=lambda x, y: ' '.join([x, y]))
Fuse the current segment with the following segment
| Name | Type | Description | Default |
|---|---|---|---|
label_fun |
function |
Function for joining interval labels. | lambda x, y: ' '.join([x, y]) |
sequences.sequences.SequenceInterval.index(subset_instance)
Returns subset instance index
| Name | Type | Description | Default |
|---|---|---|---|
subset_instance |
SequenceInterval | A subset instance to get the index of. | required |
| Type | Description |
|---|---|
| int | The index of subset_instance |
sequences.sequences.SequenceInterval.pop(subset_instance)
Pop a sequence interval from the subset list
| Name | Type | Description | Default |
|---|---|---|---|
subset_instance |
SequenceInterval | A sequence interval to pop | required |
sequences.sequences.SequenceInterval.set_feature(feature, value)
Sets arbitrary object attribute
This will be most useful for creating custom subclasses.
| Name | Type | Description | Default |
|---|---|---|---|
feature |
str | New attribute name | required |
value |
Any | New attribute value | required |