Skip to content

Text 0.4.0 tfidfvectorizer getfeaturenames

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

Lodestar.Text 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.

TfidfVectorizer.GetFeatureNames

The term each column stands for, in column order.

public IReadOnlyList<string> GetFeatureNames()

ReturnsIReadOnlyList<string> of length ColumnCount, sorted, where index i names the term weighted by column i.

ExceptionsInvalidOperationException when nothing has been fitted yet.

Example — the names, and the weight beside them.

using Lodestar.Text.Vectorization;

var tv = new TfidfVectorizer();
CsrMatrix weighted = tv.FitTransform(["the cat eats", "the dog eats", "the cat and the dog"]);

IReadOnlyList<string> names = tv.GetFeatureNames();
string first = names[0];  // => and

Remarks — the vocabulary is sorted and shared with the count half, so this returns exactly what CountVectorizer.GetFeatureNames would over the same corpus and options. Pairing it with Idf is how to see which terms the weighting considered rare.

HashingVectorizer has no counterpart, because it keeps no vocabulary to name.

Applies to — net10.0, netstandard2.0.

See alsoTfidfVectorizer, CountVectorizer.GetFeatureNames.

Lodestar

Project

Clone this wiki locally