pub struct Corpus { /* private fields */ }Expand description
Training corpus management.
Implementations§
Source§impl Corpus
impl Corpus
Sourcepub fn from_examples(examples: Vec<TrainingExample>) -> Self
pub fn from_examples(examples: Vec<TrainingExample>) -> Self
Create corpus from examples.
Sourcepub fn add(&mut self, example: TrainingExample)
pub fn add(&mut self, example: TrainingExample)
Add a training example.
Sourcepub fn generate_synthetic(count: usize) -> Self
pub fn generate_synthetic(count: usize) -> Self
Generate synthetic training data.
Sourcepub fn to_training_data(&self) -> (Vec<Vec<f32>>, Vec<u8>)
pub fn to_training_data(&self) -> (Vec<Vec<f32>>, Vec<u8>)
Convert to feature matrix (X) and labels (y).
Sourcepub fn examples(&self) -> &[TrainingExample]
pub fn examples(&self) -> &[TrainingExample]
Get examples as slice.
Sourcepub fn category_distribution(&self) -> HashMap<ErrorCategory, usize>
pub fn category_distribution(&self) -> HashMap<ErrorCategory, usize>
Get category distribution for analysis.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Corpus
impl RefUnwindSafe for Corpus
impl Send for Corpus
impl Sync for Corpus
impl Unpin for Corpus
impl UnsafeUnpin for Corpus
impl UnwindSafe for Corpus
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 more