-
Notifications
You must be signed in to change notification settings - Fork 0
Embeddings 0.7.0 addedtoken gethashcode
github-actions[bot] edited this page Sep 10, 2026
·
1 revision
Lodestar.Embeddings 0.7.0. This page is frozen at that release. Read the current documentation for what
mainsays now. A link to a decision or a migration page followsmain, and leaves the archive.
A hash consistent with that equality.
public int GetHashCode()Returns — int, over the content, the id and the flags.
Example — equal tokens hash alike.
using Lodestar.Embeddings.Tokenization;
var first = new AddedToken("[MASK]", 103) { Special = true };
var second = new AddedToken("[MASK]", 103) { Special = true };
bool consistent = first.Equals(second) && first.GetHashCode() == second.GetHashCode(); // => TrueRemarks — every field that Equals reads contributes, which is what
the contract requires and what makes an AddedToken safe as a dictionary key or in a set — the
shape a vocabulary's added-token list is usually searched as.
Applies to — net10.0, netstandard2.0.
See also — AddedToken.Equals.