Skip to content
Usage/Main.md -> Usage.md authored by Santiago Yépez's avatar Santiago Yépez
# RangeHandling - Usage guide *(wiki under development but browsable)*
## Introduction
RangeHandling is a Perl library for performing operations on sequences of data structures enclosed within ranges or intervals. Its core is made up of three packages that, throughout the guide, will be referred to as classes. Those classes are: `Range`, `Node` and `Chain`. An object of the `Range` class holds the numerical stamps that create the range/interval within which data structures will be enclosed. An object of the `Node` class, on the other hand, stores such data structures along with the corresponding `Range` object. Finally, an object of the `Chain` class stores a collection of `Node` objects and is responsible for having them neatly organized by their `Range` objects. The following image shows how the mentioned objects relate to each other:
![Core objects](https://gdurl.com/hZNW)
Additionally, the library provides a parser for Praat's interval-tier `.TextGrid` files that converts them into the corresponding `Range`, `Node` and `Chain` output objects.
This guide aims to function as a detailed source of information on the library and the components mentioned above.
### First steps
#### Installation
Download the library's source code from the [https://gitlab.com/SantiagoYepez/RangeHandling](https://gitlab.com/SantiagoYepez/RangeHandling) repository and copy the `YERangeHandling` directory either into a Perl module's directory, so that it is globally available, or into a directory in where its usage is expected. Then, add the following reference to the library inside the corresponding main script:
```perl
use YERangeHandling::Chain;
```
This instruction will make the `Range`, `Node` and `Chain` classes available throughout the script.
**Note 1:** By adding the mentioned reference to the main script, two other classes called `Rule` and `esylio` will also be made available. The `Rule` class is intended to be used from the main script and information on it will be opportunely shown, on the other hand, the `esylio` one is a helper intended to be used exclusively by the library's core classes and its methods should not be directly called from the main script.
**Note 2:** In case the `YERangeHandling` directory is not located inside one of the paths kept by the `@INC` variable (Perl modules' paths), it may be desired to add the following instruction before referencing the library:
```perl
use lib '<path>';
```
where `<path>` corresponds to the directory where the `YERangeHandling` directory lies. Thus and if the `YERangeHandling` directory lies alongside the main script, the complete reference should look like:
```perl
use lib '.';
use YERangeHandling::Chain;
```
**Note 3 - For users of `.TextGrid` files:** In case the usage of the library's parser for `.TextGrid` files is required, instead of adding the reference mentioned above, do add the following one which will also make a class called `TextGrid` available throughout the main script:
```perl
use YERangeHandling::TextGrid;
```
Statements exposed in both **Note 1** and **Note 2** still apply.
### Guide organization
Description of classes and their methods are presented in the following order, and it is suggested that they be visited in such order:
1. `Range` class: [visit](./Range).
2. `Node` class: [visit](./Node).
3. `Chain` class: [visit](./Chain).
4. `TextGrid` class: [visit](./TextGrid).