pub struct HashEmbedder { /* private fields */ }Expand description
A deterministic feature-hashing embedder.
Implementations§
Source§impl HashEmbedder
impl HashEmbedder
Sourcepub fn new(dim: usize) -> Self
pub fn new(dim: usize) -> Self
Create a dim-dimensional hash embedder with default n-gram and seed.
Sourcepub fn with_params(dim: usize, ngram: u8, seed: u64) -> Self
pub fn with_params(dim: usize, ngram: u8, seed: u64) -> Self
Create with explicit parameters. All three are folded into the
EmbedderId, so changing any of them invalidates an old index.
Trait Implementations§
Source§impl Clone for HashEmbedder
impl Clone for HashEmbedder
impl Copy for HashEmbedder
Source§impl Debug for HashEmbedder
impl Debug for HashEmbedder
Source§impl Embedder for HashEmbedder
impl Embedder for HashEmbedder
Source§type EmbedFuture<'a> = Ready<Result<(), Error>>
type EmbedFuture<'a> = Ready<Result<(), Error>>
The future returned by
Embedder::embed_batch.Source§fn identity(&self) -> EmbedderId
fn identity(&self) -> EmbedderId
This embedder’s stable identity.
Source§fn embed_batch<'a>(
&'a self,
texts: &'a [&'a str],
out: &'a mut [f32],
) -> Self::EmbedFuture<'a>
fn embed_batch<'a>( &'a self, texts: &'a [&'a str], out: &'a mut [f32], ) -> Self::EmbedFuture<'a>
Auto Trait Implementations§
impl Freeze for HashEmbedder
impl RefUnwindSafe for HashEmbedder
impl Send for HashEmbedder
impl Sync for HashEmbedder
impl Unpin for HashEmbedder
impl UnsafeUnpin for HashEmbedder
impl UnwindSafe for HashEmbedder
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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