leipzig-frequency / README.md
lancejpollard's picture
Upload README.md with huggingface_hub
2ff72af verified
---
license: cc-by-4.0
pretty_name: 'Leipzig Corpora Frequency Data'
tags:
- language
- frequency
- corpus
- linguistics
- nlp
configs:
- config_name: default
data_files: 'base/**/*.parquet'
default: true
---
# Leipzig Corpora Frequency Data
Word frequency lists and co-occurrence data from the Leipzig Corpora
Collection, converted to Parquet.
Covers hundreds of languages across news, web, Wikipedia, and mixed
sources. Each corpus includes token frequencies, source provenance,
and statistical co-occurrence pairs.
## Contents
```
base/
<language>/
<source>-<date>-<size>/
metadata.json
string.0001.parquet
source.0001.parquet
cooccurrence.sentence.0001.parquet
cooccurrence.neighbor.0001.parquet
```
Shards are split at ~200-400 MB each. Small corpora may have a single
shard. Large corpora have multiple (`0001.parquet`, `0002.parquet`,
etc.).
Example: `base/afr/news-2020-30K/string.0001.parquet`
Languages use ISO 639-3 codes, sometimes with region suffixes (e.g.
`ara-eg` for Egyptian Arabic).
## Files per corpus
| File | Format | Description |
| ------------------------------------ | ------- | ---------------------------------------------------- |
| `metadata.json` | JSON | Language, source type, date, size, original filename |
| `string.NNNN.parquet` | Parquet | Token frequency list (words and punctuation) |
| `source.NNNN.parquet` | Parquet | Source article URLs and dates |
| `cooccurrence.sentence.NNNN.parquet` | Parquet | Word pairs appearing in the same sentence |
| `cooccurrence.neighbor.NNNN.parquet` | Parquet | Word pairs appearing adjacent to each other |
"Strings" instead of "words" because the list includes punctuation,
special characters, and other non-word tokens alongside actual words.
Parquet files use ZSTD compression for ~4x smaller size than equivalent
JSONL, with column-wise reads for fast filtering.
## Usage
```python
from datasets import load_dataset
ds = load_dataset("cluesurf/leipzig-frequency")
```
Or query directly with DuckDB:
```sql
SELECT text, frequency
FROM 'base/afr/news-2020-30K/string.*.parquet'
ORDER BY frequency DESC
LIMIT 20;
```
## Record schemas
### metadata.json
```json
{
"language": "afr",
"source": "news",
"date": "2020",
"size": "30K",
"file": "afr_news_2020_30K"
}
```
### string.NNNN.parquet
| Column | Type |
| --------- | ------ |
| id | int32 |
| text | string |
| frequency | int64 |
Example row: `{ id: 101, text: "die", frequency: 30994 }`
### source.NNNN.parquet
| Column | Type |
| ------ | ------ |
| id | int32 |
| url | string |
| date | string |
Example row: `{ id: 1, url: "https://carletonvilleherald.com/...", date: "2020-05-17" }`
### cooccurrence.sentence.NNNN.parquet
| Column | Type |
| ------------ | ------- |
| string_1_id | int32 |
| string_2_id | int32 |
| frequency | int64 |
| significance | float64 |
Example row: `{ string_1_id: 116, string_2_id: 4688, frequency: 5, significance: 7.61 }`
### cooccurrence.neighbor.NNNN.parquet
Same schema as `cooccurrence.sentence`, but for words appearing
adjacent to each other rather than in the same sentence.
## Source
Downloaded from the
[Leipzig Corpora Collection](https://wortschatz.uni-leipzig.de/en/download)
at the University of Leipzig.
Original archives are `.tar.gz` files containing tab-delimited `.txt`
data following the Wortschatz database schema.
## Sources
- [Leipzig Corpora Collection](https://wortschatz.uni-leipzig.de/en/download)
- [Wortschatz project](https://wortschatz.uni-leipzig.de)
- D. Goldhahn, T. Eckart, U. Quasthoff: Building Large Monolingual
Dictionaries at the Leipzig Corpora Collection: From 100 to 200
Languages. In: Proceedings of LREC, 2012.
## License
CC-BY-4.0, as specified by the Leipzig Corpora Collection.