File size: 1,941 Bytes
acf58cd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
341cc76
9802d76
 
 
 
 
 
 
 
 
acf58cd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
license: bsd-3-clause
language:
- zh
- en
- id
- ja
- es
---

# TUBELEX Statistical Language Models

N-gram models on the TUBELEX YouTube subtitle corpora. We provide modified Kneser-Ney language models of order 5 ([Heafield et al., 2013](https://aclanthology.org/P13-2121)), i.e. [KenLM](https://kheafield.com/code/kenlm/) models.

The files are in LZMA-compressed ARPA format.

# What is TUBELEX?

TUBELEX is a YouTube subtitle corpus currently available for Chinese, English, Indonesian, Japanese, and Spanish.

- [preprint](https://arxiv.org/abs/2410.03240), BibTeX entry:
```
@article{nohejl_etal_2024_film,
  title={Beyond {{Film Subtitles}}: {{Is YouTube}} the {{Best Approximation}} of {{Spoken Vocabulary}}?},
  author={Nohejl, Adam and Hudi, Frederikus and Kardinata, Eunike Andriani and Ozaki, Shintaro and Riera Machin, Maria Angelica and Sun, Hongyu and Vasselli, Justin and Watanabe, Taro},
  year={2024}, eprint={2410.03240}, archiveprefix={arXiv}, primaryclass={cs.CL},
  url={https://arxiv.org/abs/2410.03240v1}, journal={ArXiv preprint}, volume={arXiv:2410.03240v1 [cs]}
}
```

- [fastText word embeddings](https://huggingface.co/naist-nlp/tubelex-fasttext)
- [word frequencies and code](https://github.com/naist-nlp/tubelex)

# Usage

To download and use the KenLM models in Python, first install dependencies:

```
pip install huggingface_hub
pip install https://github.com/kpu/kenlm/archive/master.zip
```

You can then use e.g. the English (`en`) model in the following way:

```
import kenlm
from huggingface_hub import hf_hub_download

model_file = hf_hub_download(repo_id='naist-nlp/tubelex-kenlm', filename='tubelex-en.arpa.xz')
# Loading the model requires KenLM to be compiled with LZMA support (`HAVE_XZLIB`).
# Otherwise you fill first need to decompress the model.
model = kenlm.Model(model_file)

text = ''a sequence of words'  # pre-tokenized, lower-cased, without punctuation
model.perplexity(text)
```