HashingEmbedder class

A deterministic, offline embedder based on feature hashing of words, word bigrams and character trigrams.

It captures lexical overlap, not meaning — "car" and "automobile" are unrelated to it — so it is a baseline for tests, demos and fully offline apps, not a substitute for a neural model. Vectors are L2-normalised, so it pairs with the cosine metric.

Implemented types
Available extensions

Constructors

HashingEmbedder({int dimensions = 256})
Creates an embedder producing dimensions-dimensional vectors.

Properties

dimensions → int
Length of every vector this embedder returns.
final
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

close() → void
Releases network resources.
override
embed(List<String> texts, {EmbedPurpose purpose = EmbedPurpose.document}) → Future<List<Float32List>>
Embeds texts, returning one vector per text, in order.
override
embedOne(String text, {EmbedPurpose purpose = EmbedPurpose.document}) → Future<Float32List>

Available on Embedder, provided by the EmbedOne extension

Embeds a single text.
embedSync(String text) → Float32List
The vector for text, synchronously.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited