Skip to content

Embeddings addedtoken gethashcode

github-actions[bot] edited this page Aug 26, 2026 · 24 revisions

Development build. This page describes main, not a released package. The latest published Lodestar.Embeddings is 0.4.0 — read its documentation.

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