File size: 4,034 Bytes
c7669ca
 
1316a65
c7669ca
 
 
 
 
 
 
 
2ff72af
c7669ca
 
 
 
 
2ff72af
 
c7669ca
1316a65
2ff72af
 
c7669ca
 
 
 
 
 
 
 
2ff72af
 
 
 
c7669ca
 
2ff72af
 
 
 
 
c7669ca
1316a65
 
c7669ca
 
 
2ff72af
 
 
 
 
 
 
c7669ca
 
 
 
2ff72af
 
 
c7669ca
 
 
 
 
 
 
 
2ff72af
 
 
 
 
 
 
 
 
c7669ca
 
 
 
 
 
 
 
 
 
 
 
 
 
2ff72af
c7669ca
2ff72af
 
 
 
 
c7669ca
2ff72af
c7669ca
2ff72af
c7669ca
2ff72af
 
 
 
 
c7669ca
2ff72af
c7669ca
2ff72af
c7669ca
2ff72af
 
 
 
 
 
c7669ca
2ff72af
c7669ca
2ff72af
 
 
 
c7669ca
 
 
1316a65
 
c7669ca
 
1316a65
 
c7669ca
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
---
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.