Skip to content

Embeddings 0.4.0 addedtoken gethashcode

github-actions[bot] edited this page Aug 21, 2026 · 1 revision

Lodestar.Embeddings 0.4.0. This page is frozen at that release. Read the current documentation for what main says now. A link to a decision or a migration page follows main, and leaves the archive.

AddedToken.GetHashCode

A hash consistent with that equality.

public int GetHashCode()

Returnsint, 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();  // => True

Remarks — 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 alsoAddedToken.Equals.

Lodestar

Project

Clone this wiki locally