A collection of written texts is called a corpus (plural: corpora). A corpus can range from a small set of documents to a large database of millions of texts.
Corpora are widely used in linguistic research—for example, studying word frequency or sentence structure. They also serve other purposes, such as creating language models or training machine learning algorithms.