Parallel TF-IDF Index Building
SkillDocs & knowledgeProvides utilities for parallelizing TF-IDF inverted index construction using a MapReduce approach - chunking documents, computing local TF and DF in worker processes, merging partial results, and finalizing TF-IDF scores with global DF.
Available today. Use it from your connected AI after setup.
No other account needed.
Connect ahel once, and every AI you use reads what you have installed.
Then ask your AI: use the Parallel TF-IDF Index Building skill
What this skill tells your AI
The instructions your AI receives, as published by openlair/openskill in tasks-evolved/parallel-tfidf-search/environment/skills/evo-parallel-index-building/SKILL.md and read by ahel’s review.
Overview
Parallelizes TF-IDF index construction using MapReduce:
- Chunk: Split documents into chunks
- Map: Workers compute local TF and DF per chunk
- Reduce: Merge partial results (Counter.update for DF, dict.update for TF)
- Finalize: Compute IDF and TF-IDF scores, build inverted index
Key Formulas (matching sequential.py)
- TF(t,d) = count(t in d) / total_tokens(d)
- IDF(t) = log(N / df(t)) + 1
- TF-IDF = TF * IDF
- Posting lists sorted by score descending
Usage
import sys
sys.path.insert(0, '/app/environment/skills/evo-parallel-index-building/scripts')
from utils import (
chunk_documents,
map_index_chunk,
merge_partial_results,
finalize_tfidf_scores,
build_tfidf_index_parallel,
tokenize,
compute_term_frequencies
)
# Build index
index_dict, elapsed, num_docs, vocab_size = build_tfidf_index_parallel(
documents, num_workers=4, chunk_size=500
)
Functions
chunk_documents(documents, chunk_size=500)- Split docs into (doc_id, text) chunksmap_index_chunk(chunk)- Worker: compute local TF dict and DF Countermerge_partial_results(partial_results)- Merge all local TF/DF/vocabfinalize_tfidf_scores(all_doc_tf, global_df, vocabulary, num_documents)- Compute IDF and build inverted indexbuild_tfidf_index_parallel(documents, num_workers=None, chunk_size=500)- Full pipeline
Signals
- GitHub stars
- 89
- Forks
- 4
- Last commit
- Sep 2026
Advanced
- Catalog kind
- skill
- Gateway key
evo-parallel-index-building- Source
- github.com/openlair/openskill