pub struct WordCounter { /* private fields */ }Implementations§
Source§impl WordCounter
impl WordCounter
pub fn new(pre_tokenizer: PreTokenizer) -> Self
pub fn add_text(&mut self, text: &str) -> MyResult<()>
pub fn add_batch<'a, S: AsRef<str> + Sync>( &mut self, texts: &'a [S], ) -> MyResult<()>
pub fn add_source<I, S>( &mut self, source: I, options: SourceBatchOptions, ) -> MyResult<()>
pub fn merge(&mut self, other: Self) -> MyResult<()>
pub fn words(&self) -> BTreeMap<String, Freq>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn clear(&mut self)
pub fn take_counts(&mut self) -> HashMap<String, Freq, RandomState>
pub fn save<W: Write>(&self, writer: W) -> MyResult<()>
pub fn load<R: Read>(pre_tokenizer: PreTokenizer, reader: R) -> MyResult<Self>
pub fn counts(&self) -> &HashMap<String, Freq, RandomState>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for WordCounter
impl RefUnwindSafe for WordCounter
impl Send for WordCounter
impl Sync for WordCounter
impl Unpin for WordCounter
impl UnsafeUnpin for WordCounter
impl UnwindSafe for WordCounter
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
impl<C, T> CanToWord<T> for Cwhere
T: ToWord<C>,
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T, U> Imply<T> for U
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