pub struct TextDataset { /* private fields */ }Expand description
A dataset of text samples with labels.
Implementations§
Source§impl TextDataset
impl TextDataset
Sourcepub fn new(
texts: Vec<String>,
labels: Vec<usize>,
vocab: Vocab,
max_length: usize,
) -> Self
pub fn new( texts: Vec<String>, labels: Vec<usize>, vocab: Vocab, max_length: usize, ) -> Self
Creates a new TextDataset.
Sourcepub fn from_samples<T: Tokenizer>(
samples: &[(String, usize)],
tokenizer: &T,
min_freq: usize,
max_length: usize,
) -> Self
pub fn from_samples<T: Tokenizer>( samples: &[(String, usize)], tokenizer: &T, min_freq: usize, max_length: usize, ) -> Self
Creates a TextDataset from raw text samples with a tokenizer.
Sourcepub fn num_classes(&self) -> usize
pub fn num_classes(&self) -> usize
Returns the number of classes.
Sourcepub fn max_length(&self) -> usize
pub fn max_length(&self) -> usize
Returns the maximum sequence length.
Trait Implementations§
Source§impl Dataset for TextDataset
impl Dataset for TextDataset
Auto Trait Implementations§
impl Freeze for TextDataset
impl RefUnwindSafe for TextDataset
impl Send for TextDataset
impl Sync for TextDataset
impl Unpin for TextDataset
impl UnwindSafe for TextDataset
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> 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