tatoeba_21-dec-2024 / README.md
Tom9358's picture
Update README.md
f440fff verified
metadata
license: cc-by-2.0
language:
  - nl
  - en
  - de
  - es
  - gos
task_categories:
  - translation
tags:
  - linguistics
  - language
  - machine_translation
  - machine-translation
  - translation
  - tatoeba
pretty_name: Upload of 21 December 2024 version of Tatoeba dataset.
size_categories:
  - 10M<n<100M

I would recommend anyone to download the most recent version of the files directly from Tatoeba. Since the most recent version of the dataset on huggingface is already quite old, I uploaded today's versions of the Tatoeba sentences. I uploaded the full dataset, as well as some files for some individual languages that I happen to speak. Honorable mention to Gronings, language code gos.

Example code to download the most recent version of the Tatoeba dataset:

import requests

with open("downloadlinks.txt") as file:
    for link in file:
        link = link.strip()
        if link:
            response = requests.get(link)
            open(link.split("/")[-1], "wb").write(response.content)

Where downloadlinks.txt could contain something like:

https://downloads.tatoeba.org/exports/links.tar.bz2
https://downloads.tatoeba.org/exports/per_language/eng/eng_sentences.tsv.bz2
https://downloads.tatoeba.org/exports/per_language/gos/gos_sentences.tsv.bz2
https://downloads.tatoeba.org/exports/per_language/nld/nld_sentences.tsv.bz2
https://downloads.tatoeba.org/exports/sentences_detailed.tar.bz2
https://downloads.tatoeba.org/exports/sentences.tar.bz2

Here's some more code to help you get started, linking the sentences. Assuming you've downloaded the files:

import pandas as pd
lang1 = "eng"
lang2 = "gos"

lang1_sentences = pd.read_csv(f"{lang1}_sentences.tsv.bz2", sep="\t", header=None, names=["id", "language", lang1])
lang2_sentences = pd.read_csv(f"{lang2}_sentences.tsv.bz2", sep="\t", header=None, names=["id", "language", lang2])
link_sentences = pd.read_csv("links.tar.bz2", sep="\t", header=None, names=["origin", "translation"])

df_parallel = link_sentences.merge(lang1_sentences, left_on="origin", right_on="id").merge(lang2_sentences, left_on="translation", right_on="id")[["origin", "translation", lang1, lang2]]
print(df_parallel)