pub struct DatasetCardValidator;Expand description
Validator for HuggingFace dataset card YAML metadata.
Validates common fields against HuggingFace’s official accepted values.
§Example
use alimentar::hf_hub::DatasetCardValidator;
let readme = r"---
license: mit
task_categories:
- translation
---
";
let errors = DatasetCardValidator::validate_readme(readme);
assert!(errors.is_empty());Implementations§
Source§impl DatasetCardValidator
impl DatasetCardValidator
Sourcepub fn validate_readme(content: &str) -> Vec<ValidationError>
pub fn validate_readme(content: &str) -> Vec<ValidationError>
Validates a README.md content and returns any validation errors.
Parses the YAML frontmatter and validates:
task_categories: Must be from the official HuggingFace listsize_categories: Must match the HuggingFace format
Sourcepub fn validate_readme_strict(content: &str) -> Result<()>
pub fn validate_readme_strict(content: &str) -> Result<()>
Validates a README file and returns a Result.
Returns Ok(()) if valid, or Err with combined error messages.
Sourcepub fn is_valid_task_category(category: &str) -> bool
pub fn is_valid_task_category(category: &str) -> bool
Check if a task category is valid.
Sourcepub fn is_valid_license(license: &str) -> bool
pub fn is_valid_license(license: &str) -> bool
Check if a license is valid (case-insensitive).
Sourcepub fn is_valid_size_category(size: &str) -> bool
pub fn is_valid_size_category(size: &str) -> bool
Check if a size category is valid.
Sourcepub fn suggest_task_category(invalid: &str) -> Option<&'static str>
pub fn suggest_task_category(invalid: &str) -> Option<&'static str>
Suggest a similar valid task category for common mistakes.
Trait Implementations§
Source§impl Debug for DatasetCardValidator
impl Debug for DatasetCardValidator
Source§impl Default for DatasetCardValidator
impl Default for DatasetCardValidator
Source§fn default() -> DatasetCardValidator
fn default() -> DatasetCardValidator
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for DatasetCardValidator
impl RefUnwindSafe for DatasetCardValidator
impl Send for DatasetCardValidator
impl Sync for DatasetCardValidator
impl Unpin for DatasetCardValidator
impl UnsafeUnpin for DatasetCardValidator
impl UnwindSafe for DatasetCardValidator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.