Text rakeoptions gethashcode - CyrilB1531/lodestar GitHub Wiki

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

HomeTextKeyword extraction

RakeOptions.GetHashCode

A hash consistent with the equality, in constant time.

public int GetHashCode()

Returns — a hash over the scalars and whether stop words are present.

Example — options equal as sets hash alike.

using Lodestar.Text.Keywords;

RakeOptions left = new() { StopWords = ["the", "the", "a"] };
RakeOptions right = new() { StopWords = ["a", "the"] };

bool alike = left.GetHashCode() == right.GetHashCode();  // => True

Remarks — the stop words contribute only their presence, never their count. Set equality makes ["the", "the"] equal ["the"] while the counts differ, and equal objects must hash alike; hashing the words themselves would be the walk this avoids.

Applies to — net10.0, netstandard2.0.

See alsoRakeOptions.Equals, RakeOptions.