English

Quantifying the Dissimilarity of Texts

Computation and Language 2023-05-05 v1 Statistical Mechanics Physics and Society

Abstract

Quantifying the dissimilarity of two texts is an important aspect of a number of natural language processing tasks, including semantic information retrieval, topic classification, and document clustering. In this paper, we compared the properties and performance of different dissimilarity measures DD using three different representations of texts -- vocabularies, word frequency distributions, and vector embeddings -- and three simple tasks -- clustering texts by author, subject, and time period. Using the Project Gutenberg database, we found that the generalised Jensen--Shannon divergence applied to word frequencies performed strongly across all tasks, that DD's based on vector embedding representations led to stronger performance for smaller texts, and that the optimal choice of approach was ultimately task-dependent. We also investigated, both analytically and numerically, the behaviour of the different DD's when the two texts varied in length by a factor hh. We demonstrated that the (natural) estimator of the Jaccard distance between vocabularies was inconsistent and computed explicitly the hh-dependency of the bias of the estimator of the generalised Jensen--Shannon divergence applied to word frequencies. We also found numerically that the Jensen--Shannon divergence and embedding-based approaches were robust to changes in hh, while the Jaccard distance was not.

Keywords

Cite

@article{arxiv.2305.02457,
  title  = {Quantifying the Dissimilarity of Texts},
  author = {Benjamin Shade and Eduardo G. Altmann},
  journal= {arXiv preprint arXiv:2305.02457},
  year   = {2023}
}

Comments

16 pages, 4 figures, part of the Special Issue Novel Methods and Applications in Natural Language Processing

R2 v1 2026-06-28T10:25:07.276Z