# 文本分割

文本分割是一种自然语言处理方法，它将连续文本划分为有意义的单元，如词、句子或多段落主题片段。主题级分割生成互不重叠的片段，反映文档的子主题结构；TextTiling算法利用词汇共现和分布模式来实现这一目标。<sup>[1](https://aclanthology.org/J97-1003.pdf)</sup> 其输出为更高层次的话语分析（如话语解析）提供输入，并支持文本摘要和段落检索等下游应用。<sup>[2](https://www.ijcai.org/proceedings/2018/0579.pdf)</sup> 系统可在词、句子（或伪句子）或段落级别运行：词主题模型和词嵌入模型基于词运作，而句子嵌入模型基于句子或说话人轮次运作。<sup>[3](https://aclanthology.org/2024.findings-emnlp.174.pdf)</sup>

| 关键事实 | 详情 |
|---|---|
| 粒度级别 | 词、句子/伪句子、主题（话语）分割<sup>[3](https://aclanthology.org/2024.findings-emnlp.174.pdf)</sup> |
| 经典算法 | TextTiling：分词为伪句子、词汇评分、在得分图最深谷处检测边界<sup>[4](https://people.ischool.berkeley.edu/~hearst/papers/acl94.pdf)</sup> |
| 典型参数 | 伪句子大小 \( w = 20 \) 个词元；块大小 \( k = 6 \)<sup>[4](https://people.ischool.berkeley.edu/~hearst/papers/acl94.pdf)</sup> |
| 相似度度量 | 相邻词频向量块之间的余弦相似度<sup>[3](https://aclanthology.org/2024.findings-emnlp.174.pdf)</sup> |
| 标准指标 | 基于窗口的Pk和WindowDiff，以及边界相似度和WinPR<sup>[3](https://aclanthology.org/2024.findings-emnlp.174.pdf)</sup> |
| 经典基准 | 在已发表的比较中，TextTiling在Choi数据集上的Pk约为44–45.25%（0.44–0.4525）<sup>[3](https://aclanthology.org/2024.findings-emnlp.174.pdf)</sup><sup> • </sup><sup>[2](https://www.ijcai.org/proceedings/2018/0579.pdf)</sup> |
| 近期转变 | 经过提示优化后，LLM零样本分割优于其他无监督方法<sup>[3](https://aclanthology.org/2024.findings-emnlp.174.pdf)</sup> |

## 工作原理

基于词汇衔接的主题分割依赖于一个简单信号：潜在边界两侧词语使用的较大差异是边界的正指标，而较小差异则是负指标。<sup>[5](https://link.springer.com/content/pdf/10.1023/A:1007506220214.pdf)</sup> TextTiling通过在文本上滑动两个相邻窗口，并使用相对词袋向量表示之间的余弦相似度比较窗口内的句子块来实现这一点。<sup>[3](https://aclanthology.org/2024.findings-emnlp.174.pdf)</sup> 给定两个块 \( b_{1} \) 和 \( b_{2} \)，每个包含k个词元序列，相似度基于词频计算，产生0到1之间的得分。<sup>[4](https://people.ischool.berkeley.edu/~hearst/papers/acl94.pdf)</sup>

边界被放置在相似度曲线的尖锐谷处，使用深度得分：对于相似度为 \( s_{i} \) 的间隙，深度对两侧最近峰的相对高度求和，<sup>[6](https://www.inf.ed.ac.uk/teaching/courses/anlp/lectures/28/)</sup> 计算为 \( d_{i} = \tfrac{1}{2}((h_{l}(i) - s_{i}) + (h_{r}(i) - s_{i})) \)，其中 \( h_{l}(i) \) 和 \( h_{r}(i) \) 是间隙左右两侧最高的非递增相似度得分。<sup>[7](https://www.inf.uni-hamburg.de/en/inst/ab/lt/publications/2012-riedletal-naacl-text-segmentation.pdf)</sup> 第二种评分变体——词汇引入——计算间隙两侧出现了多少新词项。<sup>[1](https://aclanthology.org/J97-1003.pdf)</sup>

## 实现方法

核心算法包含三部分：分词、相似度确定和边界识别。<sup>[4](https://people.ischool.berkeley.edu/~hearst/papers/acl94.pdf)</sup> 在实践中，将w设为每个词元序列20个词元对许多文本效果最佳，块大小k = 6效果良好。<sup>[4](https://people.ischool.berkeley.edu/~hearst/papers/acl94.pdf)</sup> 在词汇引入变体中，词汇得分是区间内新词数除以该区间长度；当 \( w = 20 \) 时，区间为40个词元，接近尤曼斯（Youmans）（1991）建议的参数35。<sup>[1](https://aclanthology.org/J97-1003.pdf)</sup> NLTK实现将其暴露为 \( \mathrm{score}(i) = (\mathrm{new}_{L}(i) + \mathrm{new}_{R}(i)) / (2 \cdot w) \)，同时提供块比较、平滑和截断选项。<sup>[8](https://github.com/nltk/nltk/blob/master/nltk/tokenize/texttiling.py)</sup>

边界识别对深度得分排序并在最大谷处切割。如果已知期望的片段数n，则使用n − 1个最高深度得分来放置边界；否则仅当深度得分超过 \( \mu - \sigma/2 \) 时应用截断，均值和标准差基于所有深度得分计算。<sup>[7](https://www.inf.uni-hamburg.de/en/inst/ab/lt/publications/2012-riedletal-naacl-text-segmentation.pdf)</sup> [评估](https://www.edgepedia.org/zh/evaluation)通常使用基于窗口的Pk和WindowDiff，它们在参考边界和假设边界上滑动窗口并计算不匹配数，<sup>[3](https://aclanthology.org/2024.findings-emnlp.174.pdf)</sup> 其中WindowDiff仅计算窗口内的遗漏。<sup>[6](https://www.inf.ed.ac.uk/teaching/courses/anlp/lectures/28/)</sup>

## 起源

TextTiling由玛蒂·A·赫斯特（Marti A. Hearst）在1994年的论文《说明性文本的多段落分割》中描述。<sup>[9](https://doi.org/10.48550/arxiv.cmp-lg/9406037)</sup> 该方法还作为加州大学伯克利分校一篇学位论文中的两种结构检测算法之一出现，在那里被描述为使用领域无关的词汇频率和分布信息将文本划分为多段落片段。<sup>[10](https://www2.eecs.berkeley.edu/Pubs/TechRpts/1994/5190.html)</sup> 期刊版本《TextTiling：将文本分割为多段落子主题片段》发表于《计算语言学》23(1)。<sup>[1](https://aclanthology.org/J97-1003.pdf)</sup>

该方法建立在早期工作的基础上，这些工作从简编版《罗杰同义词词典》手工计算词汇链，并表明词汇链对应于文本的结构元素：当一个词汇链结束时，语言片段也倾向于结束。<sup>[11](https://www.cs.toronto.edu/pub/gh/Morris%2BHirst-91.pdf)</sup>

## 变体

若干命名算法替换了TextTiling流程的部分环节。C99基于其直觉但用分裂聚类算法替代了相似度评分步骤，改进了原始方法。<sup>[3](https://aclanthology.org/2024.findings-emnlp.174.pdf)</sup> TopicTiling将每个块表示为T维主题ID向量，这些ID由T个主题的LDA模型推断分配给词语，并使用窗口参数w（指定左右各多少句子定义两个块）在每个位置计算连贯性得分；余弦相似度接近1表示相邻块之间高度相似。<sup>[7](https://www.inf.uni-hamburg.de/en/inst/ab/lt/publications/2012-riedletal-naacl-text-segmentation.pdf)</sup> BayesSeg在基于计数的语言模型中加入了线索短语的概率模型，取得了仍有竞争力的结果。<sup>[3](https://aclanthology.org/2024.findings-emnlp.174.pdf)</sup> 其他路线包括基于HMM的计数模型、U00线性动态规划方法和GraphSeg，后者通过词嵌入相似度图比较连续句子。<sup>[3](https://aclanthology.org/2024.findings-emnlp.174.pdf)</sup>

神经变体使用BERT编码句子，要么插入TextTiling等传统技术中<sup>[3](https://aclanthology.org/2024.findings-emnlp.174.pdf)</sup>，要么用于层次化Transformer中。<sup>[12](https://acl-bg.org/proceedings/2023/RANLP%202023/pdf/2023.ranlp-1.46.pdf)</sup> 一个代表性的嵌入基线为每个句子计算其与之前5个句子的余弦相似度的加权平均值，并在低谷处放置边界，阈值0.3由人工测试设定。<sup>[13](https://arxiv.org/html/2601.03276v1)</sup> 近期工作还将LLM嵌入集成到经典聚类算法中（谱聚类、凝聚聚类、亲和传播、KMeans++），并提出了一种磁聚类基线，使用边界分割指标进行评估。<sup>[14](https://www.mdpi.com/2076-3417/15/19/10849)</sup>

## 应用

已发表的比较展示了从经典到神经评分的进展。在Choi基准上，一张综述表报告C99为Pk 12，U00为9，MM-DP为2.3，TopicTiling为0.95，Cross-segment BERT为0.04，Longformer+TSSP+CSSL为7.4（越低越好）。<sup>[3](https://aclanthology.org/2024.findings-emnlp.174.pdf)</sup> 基于生成式LLM的零样本分割在2023–2025年前后处于最先进水平，但2026年的工作（如判别式分割模型和SegNSP）此后已超越生成式LLM方法；生成式大语言模型可以输出段落边界，但推理成本高且难以支持长输入。<sup>[3](https://aclanthology.org/2024.findings-emnlp.174.pdf)</sup> 将分割转化为二分类，模型对每对相邻句子判定是否存在边界；已提出一种提示方法，确保输出未经编辑、更节省词元且不受模型上下文窗口限制。<sup>[13](https://arxiv.org/html/2601.03276v1)</sup> [检索增强生成](https://www.edgepedia.org/zh/retrieval-augmented-generation)推动了语义分块：流行方法在[LlamaIndex](https://www.edgepedia.org/zh/llamaindex)和[LangChain](https://www.edgepedia.org/zh/langchain)中实现，使用固定句子窗口（例如3个句子）并在嵌入相似度的阈值或百分位处分割，<sup>[15](https://link.springer.com/article/10.1007/s10791-025-09638-7)</sup> 而Meta-Chunking在预设阈值附近平衡句子边界与词元计数。<sup>[16](https://arxiv.org/html/2410.12788v3)</sup> 最大–最小语义分块将分块视为按嵌入相似度对连续句子进行动态聚类，避免任意选择块大小，并使用调整互信息进行评估。<sup>[15](https://link.springer.com/article/10.1007/s10791-025-09638-7)</sup> LumberChunker是杜阿尔特（Duarte）及其同事2024年提出的方法，针对长篇叙事文档分割。<sup>[17](https://doi.org/10.48550/arxiv.2406.17526)</sup>

## 局限与替代方案

已记录了若干失败模式。早期工作将同义词词典信息纳入算法，但最新实验发现这些信息会降低性能；仅词项重复效果就很好。<sup>[4](https://people.ischool.berkeley.edu/~hearst/papers/acl94.pdf)</sup> 由于深度是在每个词元序列上使用最高间隙计算的，分割可能落在句子中间，需要最终校正步骤。<sup>[7](https://www.inf.uni-hamburg.de/en/inst/ab/lt/publications/2012-riedletal-naacl-text-segmentation.pdf)</sup> 评估有其自身陷阱：传统分类指标会过度惩罚那些与真实边界相近却未重合的预测边界，而人类标注者往往在边界确切位置上存在分歧。<sup>[3](https://aclanthology.org/2024.findings-emnlp.174.pdf)</sup> 无参考的基于嵌入的指标仍落后于有参考的指标。<sup>[3](https://aclanthology.org/2024.findings-emnlp.174.pdf)</sup> 边界相似度指标将精确匹配评为1，不匹配评为0，距离n以内的匹配按距离线性评分，被认为优于WindowDiff和Pk。<sup>[13](https://arxiv.org/html/2601.03276v1)</sup> 滑动窗口相似度的替代方案包括基于HMM的计数模型、U00等动态规划方法和LLM提示。<sup>[3](https://aclanthology.org/2024.findings-emnlp.174.pdf)</sup> 语义分块相比固定大小分块是否值得其计算开销受到质疑。<sup>[15](https://link.springer.com/article/10.1007/s10791-025-09638-7)</sup>

## References

1. [TextTiling: Segmenting Text into Multi-paragraph Subtopic Passages (Computational Linguistics 23(1), 1997)](https://aclanthology.org/J97-1003.pdf)
2. [SegBot: A Generic Neural Text Segmentation Model with Pointer Network (IJCAI 2018)](https://www.ijcai.org/proceedings/2018/0579.pdf)
3. [Recent Trends in Linear Text Segmentation: A Survey (EMNLP Findings 2024)](https://aclanthology.org/2024.findings-emnlp.174.pdf)
4. [Multi-paragraph Segmentation of Expository Text (Hearst, ACL 1994)](https://people.ischool.berkeley.edu/~hearst/papers/acl94.pdf)
5. [Statistical Models for Text Segmentation (Machine Learning, Springer)](https://link.springer.com/content/pdf/10.1023/A:1007506220214.pdf)
6. [Lecture 28: Discourse, coherence, cohesion (University of Edinburgh ANLP)](https://www.inf.ed.ac.uk/teaching/courses/anlp/lectures/28/)
7. [How Text Segmentation Algorithms Gain from Topic Models (Riedl and Biemann, NAACL 2012)](https://www.inf.uni-hamburg.de/en/inst/ab/lt/publications/2012-riedletal-naacl-text-segmentation.pdf)
8. [NLTK TextTilingTokenizer source code](https://github.com/nltk/nltk/blob/master/nltk/tokenize/texttiling.py)
9. [Hearst, Marti A. (1994). Multi-Paragraph Segmentation of Expository Text. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.cmp-lg/9406037)
10. [Context and Structure in Automated Full-Text Information Access (PhD dissertation, UC Berkeley, 1994)](https://www2.eecs.berkeley.edu/Pubs/TechRpts/1994/5190.html)
11. [Lexical Cohesion Computed by Thesaural Relations as an Indicator of the Structure of Text (Computational Linguistics 17(1), 1991)](https://www.cs.toronto.edu/pub/gh/Morris%2BHirst-91.pdf)
12. [Lessons Learnt from Linear Text Segmentation: a Fair Comparison of Architectural and Sentence Encoding Strategies for Successful Segmentation (RANLP 2023)](https://acl-bg.org/proceedings/2023/RANLP%202023/pdf/2023.ranlp-1.46.pdf)
13. [Topic Segmentation Using Generative Language Models (arXiv preprint, 2026)](https://arxiv.org/html/2601.03276v1)
14. [LLM-Enhanced Semantic Text Segmentation (MDPI Applied Sciences, 2025)](https://www.mdpi.com/2076-3417/15/19/10849)
15. [Max–Min semantic chunking of documents for RAG application (Discover Computing, Springer, 2025)](https://link.springer.com/article/10.1007/s10791-025-09638-7)
16. [Meta-Chunking: Learning Text Segmentation and Semantic Completion via Logical Perception (arXiv preprint, 2024–2025)](https://arxiv.org/html/2410.12788v3)
17. [Duarte, André V. and colleagues (2024). LumberChunker: Long-Form Narrative Document Segmentation. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.2406.17526)

---
*Initially written Sep 29, 2026 · Reviewed: Sep 30, 2026 · Edited: Sep 30, 2026 · Last review: Sep 30, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据 › Language and vision AI › Natural language processing › NLP tasks and methods › Tokenization and segmentation

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/text-segmentation

English original: https://www.edgepedia.org/text-segmentation
