autointent.context.data_handler.DataHandler#
- class autointent.context.data_handler.DataHandler(dataset, force_multilabel=False, random_seed=0)#
Data handler class.
- Parameters:
dataset (autointent.Dataset)
force_multilabel (bool)
random_seed (int)
- dataset#
- n_classes#
- regexp_patterns#
- intent_descriptions#
- tags#
- property multilabel: bool#
Check if the dataset is multilabel.
- Returns:
True if the dataset is multilabel, False otherwise.
- Return type:
- train_utterances(idx=None)#
Retrieve training utterances from the dataset.
If a specific training split index is provided, retrieves utterances from the indexed training split. Otherwise, retrieves utterances from the primary training split.
- train_labels(idx=None)#
Retrieve training labels from the dataset.
If a specific training split index is provided, retrieves labels from the indexed training split. Otherwise, retrieves labels from the primary training split.
- validation_utterances(idx=None)#
Retrieve validation utterances from the dataset.
If a specific validation split index is provided, retrieves utterances from the indexed validation split. Otherwise, retrieves utterances from the primary validation split.
- validation_labels(idx=None)#
Retrieve validation labels from the dataset.
If a specific validation split index is provided, retrieves labels from the indexed validation split. Otherwise, retrieves labels from the primary validation split.
- test_utterances(idx=None)#
Retrieve test utterances from the dataset.
If a specific test split index is provided, retrieves utterances from the indexed test split. Otherwise, retrieves utterances from the primary test split.
- test_labels(idx=None)#
Retrieve test labels from the dataset.
If a specific test split index is provided, retrieves labels from the indexed test split. Otherwise, retrieves labels from the primary test split.
- oos_utterances(idx=None)#
Retrieve out-of-scope (OOS) utterances from the dataset.
If the dataset contains out-of-scope samples, retrieves the utterances from the specified OOS split index (if provided) or the primary OOS split. Returns an empty list if no OOS samples are available in the dataset.
- has_oos_samples()#
Check if there are out-of-scope samples.
- Returns:
True if there are out-of-scope samples.
- Return type:
- dump(filepath)#
Save the dataset splits and intents to a JSON file.
- Parameters:
filepath (str | pathlib.Path) – The path to the file where the JSON data will be saved.
- Return type:
None