pub struct CustomDataset { /* private fields */ }Expand description
A custom dataset defined at runtime.
Use this when you need to load a dataset that isn’t in the built-in
DatasetId enum.
§Example
use anno_core::core::dataset::{CustomDataset, Task, ParserHint, License, Domain};
use std::path::PathBuf;
let dataset = CustomDataset::new("my_ner_data", Task::NER)
.with_name("My Company NER Dataset")
.with_languages(&["en", "de"])
.with_entity_types(&["PRODUCT", "TEAM", "PROJECT"])
.with_parser(ParserHint::CoNLL)
.with_license(License::Proprietary)
.with_domain(Domain::Technical)
.with_path(PathBuf::from("/data/my_ner.conll"));Implementations§
Source§impl CustomDataset
impl CustomDataset
Sourcepub fn new(id: impl Into<String>, task: Task) -> Self
pub fn new(id: impl Into<String>, task: Task) -> Self
Create a new custom dataset with minimal required fields.
Sourcepub fn with_languages(self, langs: &[&str]) -> Self
pub fn with_languages(self, langs: &[&str]) -> Self
Set the languages covered.
Sourcepub fn with_entity_types(self, types: &[&str]) -> Self
pub fn with_entity_types(self, types: &[&str]) -> Self
Set the entity types.
Sourcepub fn with_parser(self, parser: ParserHint) -> Self
pub fn with_parser(self, parser: ParserHint) -> Self
Set the parser hint.
Sourcepub fn with_license(self, license: License) -> Self
pub fn with_license(self, license: License) -> Self
Set the license.
Sourcepub fn with_description(self, desc: impl Into<String>) -> Self
pub fn with_description(self, desc: impl Into<String>) -> Self
Set the description.
Sourcepub fn with_domain(self, domain: Domain) -> Self
pub fn with_domain(self, domain: Domain) -> Self
Set the domain.
Sourcepub fn with_stats(self, stats: DatasetStats) -> Self
pub fn with_stats(self, stats: DatasetStats) -> Self
Set dataset statistics.
Sourcepub fn with_temporal_coverage(self, coverage: TemporalCoverage) -> Self
pub fn with_temporal_coverage(self, coverage: TemporalCoverage) -> Self
Set temporal coverage.
Sourcepub fn with_secondary_tasks(self, tasks: Vec<Task>) -> Self
pub fn with_secondary_tasks(self, tasks: Vec<Task>) -> Self
Add secondary tasks.
Sourcepub fn constructed(self) -> Self
pub fn constructed(self) -> Self
Mark as constructed language.
Sourcepub fn historical(self) -> Self
pub fn historical(self) -> Self
Mark as historical language.
Sourcepub fn requires_authentication(self) -> Self
pub fn requires_authentication(self) -> Self
Mark as requiring authentication.
Sourcepub fn with_version(self, version: impl Into<String>) -> Self
pub fn with_version(self, version: impl Into<String>) -> Self
Set version string.
Sourcepub fn languages_owned(&self) -> &[String]
pub fn languages_owned(&self) -> &[String]
Get languages as owned strings (for custom datasets).
Sourcepub fn entity_types_owned(&self) -> &[String]
pub fn entity_types_owned(&self) -> &[String]
Get entity types as owned strings (for custom datasets).
Sourcepub fn with_notes(self, notes: impl Into<String>) -> Self
pub fn with_notes(self, notes: impl Into<String>) -> Self
Set notes.
Sourcepub fn with_citation(self, citation: impl Into<String>) -> Self
pub fn with_citation(self, citation: impl Into<String>) -> Self
Set citation.
Trait Implementations§
Source§impl Clone for CustomDataset
impl Clone for CustomDataset
Source§fn clone(&self) -> CustomDataset
fn clone(&self) -> CustomDataset
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl DatasetSpec for CustomDataset
impl DatasetSpec for CustomDataset
Source§fn entity_types(&self) -> &[&str]
fn entity_types(&self) -> &[&str]
Entity types annotated in this dataset. Read more
Source§fn parser_hint(&self) -> ParserHint
fn parser_hint(&self) -> ParserHint
Parser format hint for loading.
Source§fn description(&self) -> Option<&str>
fn description(&self) -> Option<&str>
Detailed description of the dataset.
Source§fn download_url(&self) -> Option<&str>
fn download_url(&self) -> Option<&str>
URL for downloading the dataset.
Source§fn local_path(&self) -> Option<&Path>
fn local_path(&self) -> Option<&Path>
Local path if already downloaded.
Source§fn stats(&self) -> DatasetStats
fn stats(&self) -> DatasetStats
Dataset statistics (counts, splits).
Source§fn temporal_coverage(&self) -> TemporalCoverage
fn temporal_coverage(&self) -> TemporalCoverage
Temporal coverage information.
Source§fn secondary_tasks(&self) -> &[Task]
fn secondary_tasks(&self) -> &[Task]
Additional tasks supported beyond the primary task.
Source§fn is_constructed_language(&self) -> bool
fn is_constructed_language(&self) -> bool
Whether this is a constructed/artificial language dataset.
Source§fn is_historical(&self) -> bool
fn is_historical(&self) -> bool
Whether this is a historical/ancient language dataset.
Source§fn requires_auth(&self) -> bool
fn requires_auth(&self) -> bool
Whether this dataset requires special access (gated, auth, etc.).
Source§fn languages_vec(&self) -> Vec<String>
fn languages_vec(&self) -> Vec<String>
Get languages as owned Vec (for custom datasets that don’t have static data). Read more
Source§fn entity_types_vec(&self) -> Vec<String>
fn entity_types_vec(&self) -> Vec<String>
Get entity types as owned Vec (for custom datasets that don’t have static data). Read more
Source§fn supports_task(&self, task: Task) -> bool
fn supports_task(&self, task: Task) -> bool
Check if this dataset supports a specific task.
Source§fn supports_language(&self, lang: &str) -> bool
fn supports_language(&self, lang: &str) -> bool
Check if this dataset covers a specific language.
Source§fn has_entity_type(&self, entity_type: &str) -> bool
fn has_entity_type(&self, entity_type: &str) -> bool
Check if this dataset has a specific entity type.
Auto Trait Implementations§
impl Freeze for CustomDataset
impl RefUnwindSafe for CustomDataset
impl Send for CustomDataset
impl Sync for CustomDataset
impl Unpin for CustomDataset
impl UnsafeUnpin for CustomDataset
impl UnwindSafe for CustomDataset
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