tfidf-search

Build a TF-IDF search index to rank CSV text documents by cosine similarity.

Updated Dec 20, 2025
One-click install
npx skills add https://github.com/asvskartheek/awesome-claude-skills --skill tfidf-search
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tfidf-search
Source: https://github.com/asvskartheek/awesome-claude-skills/tree/main/tfidf-search
Command: npx skills add https://github.com/asvskartheek/awesome-claude-skills --skill tfidf-search

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pandas, scikit-learn, and includes scripts (resource) components.

What problem does it solve?

This Skill provides a practical, reproducible way to locate relevant text in large datasets by using TF-IDF vectorization and cosine similarity.

Core Features & Use Cases

  • TF-IDF indexing: Build a vectorized representation of documents for efficient retrieval.
  • Cosine similarity ranking: Score and rank documents by relevance to a query.
  • Command-line workflow: Simple script to load CSV data and search by text column.

Quick Start

Example: python .claude/skills/tfidf-search/scripts/tfidf_search.py songdata.csv text "Take it easy with me, please" --top_k 10

Frequently Asked Questions about tfidf-search

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I search through large text datasets with TF-IDF?

TF-IDF vectorization converts text into numerical representations that capture word importance. This Skill builds a searchable index from CSV data and ranks documents by cosine similarity to your query, returning the most relevant results efficiently.

Can I use TF-IDF and cosine similarity to find similar documents in a CSV?

Yes. This Skill loads CSV files with a text column, applies TF-IDF vectorization with scikit-learn, and scores documents using cosine similarity. It retrieves and ranks matching documents by relevance to your search query.

What's the best way to implement document retrieval without building a full search engine?

TF-IDF with cosine similarity provides lightweight document ranking without complex infrastructure. This Skill handles vectorization, CSV loading with validation, and top-k result retrieval through a simple command-line interface.

Does this work with text columns that have missing values?

Yes. This Skill includes built-in missing-value handling for CSV data, so you can process datasets with incomplete text entries without preprocessing separately.

How does TF-IDF compare to other text search methods?

TF-IDF balances efficiency and relevance by weighting term frequency against document prevalence. It works well for document ranking at moderate scale and requires minimal setup compared to machine learning-based retrieval methods.

What's the typical workflow for setting up text search on CSV data?

Load your CSV, specify the text column, run the vectorization script with a query, and retrieve top results ranked by relevance. This Skill handles indexing and ranking in one end-to-end command.