Skip to main content

CustomDataset

Struct CustomDataset 

Source
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

Source

pub fn new(id: impl Into<String>, task: Task) -> Self

Create a new custom dataset with minimal required fields.

Source

pub fn with_name(self, name: impl Into<String>) -> Self

Set the human-readable name.

Source

pub fn with_languages(self, langs: &[&str]) -> Self

Set the languages covered.

Source

pub fn with_entity_types(self, types: &[&str]) -> Self

Set the entity types.

Source

pub fn with_parser(self, parser: ParserHint) -> Self

Set the parser hint.

Source

pub fn with_license(self, license: License) -> Self

Set the license.

Source

pub fn with_description(self, desc: impl Into<String>) -> Self

Set the description.

Source

pub fn with_domain(self, domain: Domain) -> Self

Set the domain.

Source

pub fn with_url(self, url: impl Into<String>) -> Self

Set the download URL.

Source

pub fn with_path(self, path: PathBuf) -> Self

Set the local file path.

Source

pub fn with_stats(self, stats: DatasetStats) -> Self

Set dataset statistics.

Source

pub fn with_temporal_coverage(self, coverage: TemporalCoverage) -> Self

Set temporal coverage.

Source

pub fn with_secondary_tasks(self, tasks: Vec<Task>) -> Self

Add secondary tasks.

Source

pub fn constructed(self) -> Self

Mark as constructed language.

Source

pub fn historical(self) -> Self

Mark as historical language.

Source

pub fn requires_authentication(self) -> Self

Mark as requiring authentication.

Source

pub fn with_version(self, version: impl Into<String>) -> Self

Set version string.

Source

pub fn languages_owned(&self) -> &[String]

Get languages as owned strings (for custom datasets).

Source

pub fn entity_types_owned(&self) -> &[String]

Get entity types as owned strings (for custom datasets).

Source

pub fn with_notes(self, notes: impl Into<String>) -> Self

Set notes.

Source

pub fn with_citation(self, citation: impl Into<String>) -> Self

Set citation.

Trait Implementations§

Source§

impl Clone for CustomDataset

Source§

fn clone(&self) -> CustomDataset

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl DatasetSpec for CustomDataset

Source§

fn name(&self) -> &str

Human-readable name of the dataset.
Source§

fn id(&self) -> &str

Unique identifier string (snake_case, no spaces).
Source§

fn task(&self) -> Task

Primary task this dataset is designed for.
Source§

fn languages(&self) -> &[&str]

ISO 639-1 language codes (e.g., “en”, “zh”, “de”). Read more
Source§

fn entity_types(&self) -> &[&str]

Entity types annotated in this dataset. Read more
Source§

fn parser_hint(&self) -> ParserHint

Parser format hint for loading.
Source§

fn license(&self) -> License

License governing dataset usage.
Source§

fn description(&self) -> Option<&str>

Detailed description of the dataset.
Source§

fn domain(&self) -> Domain

Domain/genre of source text.
Source§

fn download_url(&self) -> Option<&str>

URL for downloading the dataset.
Source§

fn local_path(&self) -> Option<&Path>

Local path if already downloaded.
Source§

fn stats(&self) -> DatasetStats

Dataset statistics (counts, splits).
Source§

fn temporal_coverage(&self) -> TemporalCoverage

Temporal coverage information.
Source§

fn secondary_tasks(&self) -> &[Task]

Additional tasks supported beyond the primary task.
Source§

fn is_constructed_language(&self) -> bool

Whether this is a constructed/artificial language dataset.
Source§

fn is_historical(&self) -> bool

Whether this is a historical/ancient language dataset.
Source§

fn requires_auth(&self) -> bool

Whether this dataset requires special access (gated, auth, etc.).
Source§

fn version(&self) -> Option<&str>

Version string (e.g., “1.0”, “2024-01”).
Source§

fn notes(&self) -> Option<&str>

Notes or caveats about the dataset.
Source§

fn citation(&self) -> Option<&str>

Citation information (BibTeX or plain text).
Source§

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>

Get entity types as owned Vec (for custom datasets that don’t have static data). Read more
Source§

fn doi(&self) -> Option<&str>

DOI or other persistent identifier.
Source§

fn is_public(&self) -> bool

Check if this dataset is publicly available.
Source§

fn supports_task(&self, task: Task) -> bool

Check if this dataset supports a specific task.
Source§

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

Check if this dataset has a specific entity type.
Source§

impl Debug for CustomDataset

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V