跳到主要内容
uencoder

计算 TF-IDF for text importance

TF-IDF (Term Frequency-Inverse Document Frequency) measures 字 importance 在 document relative 到 corpus. Used 在搜索和 文本 mining.

  1. 1

    TF-IDF = TF × IDF. TF (项频率) = 数量的 项在 document / 总计 terms 在 document. IDF (inverse document 频率) = 记录(总计 documents / documents containing 项). Words 该出现在 许多 documents get 低 IDF (常见 words). Words 唯一到 document get 高 IDF (distinctive words). TF-IDF 是高 为 words 该是 frequent 在 one document 但罕见 across corpus.

  2. 2
    字数统计器 →

    统计 term frequencies in each document. This gives TF (raw count). Normalize by document length for comparable scores across documents of different sizes. Build a vocabulary from all documents.

  3. 3
    字符频率统计器 →

    Analyze 字符分布到 理解文本 corpus. 此 complements 字-级别分析 — 一些文本 patterns 是字符-级别 (e.g., 代码, URLs). Use 两者字 和字符频率为 comprehensive 文本分析.

常见问题

什么高 TF-IDF 评分 mean?
字是 frequent 在此 document (高 TF) 但罕见 across corpus (高 IDF). 此 means 字是 distinctive 到此 document — 它 characterizes document's topic. Search engines use TF-IDF 到排名 documents: 查询项 具有高 TF-IDF 在 document means document 是 relevant 到查询.
TF-IDF vs BM25?
BM25 是 improved version 的 TF-IDF used 通过 Elasticsearch 和 Lucene. 它 saturates TF (所以字 appearing 100 times 是不 100x 更多 relevant than 一次) 和 normalizes document 长度. BM25 通常 outperforms raw TF-IDF 为搜索 ranking. Use BM25 为 production 搜索; TF-IDF 为 teaching 和简单 applications.

解决此任务的工作流

相关工具