pedroapfilho's picture
Use HF dataset repo as source of truth for dataset.json
6c32e21 unverified
Raw History Blame Contribute Delete
721 Bytes
from typing import List
from .models import AudioSample, DatasetMetadata
class CoreMixin:
"""Base state for dataset builder."""
def __init__(self):
self.samples: List[AudioSample] = []
self.metadata = DatasetMetadata()
self._current_dir: str = ""
def get_sample_count(self) -> int:
"""Get the number of samples in the dataset."""
return len(self.samples)
def get_labeled_count(self) -> int:
"""Get the number of labeled samples."""
return sum(1 for s in self.samples if s.labeled)
def get_preprocessed_count(self) -> int:
"""Get the number of preprocessed samples."""
return sum(1 for s in self.samples if s.preprocessed)