From ce1dd707274a19d55fa01b5ce67fae3f8e7cf71c Mon Sep 17 00:00:00 2001 From: RaunakGengiti2725 Date: Mon, 9 Nov 2026 10:12:57 +0000 Subject: [PATCH 1/9] Tusom2021: add a loader for the East Tusom word list Issue #18 asks for data loaders for a multilingual speech2ipa leaderboard. Tusom2021 is next on the list after DoReCo. It is a small set of words and short phrases from one speaker, with phone labels that people wrote. The loader reads the dataset's own train, dev and test files, or all of mapping.yml, and returns the labels with no tones. WAV files that have no label are skipped and counted. 340 labels have spaces between words and 6 have a control character. Both come out of the IPA, the way VoxAngeles takes spaces out, and the exact label stays in the speaker info. --- scripts/data_loaders/Tusom2021.py | 117 ++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 scripts/data_loaders/Tusom2021.py diff --git a/scripts/data_loaders/Tusom2021.py b/scripts/data_loaders/Tusom2021.py new file mode 100644 index 00000000..612b3ad7 --- /dev/null +++ b/scripts/data_loaders/Tusom2021.py @@ -0,0 +1,117 @@ +# Tusom2021: a phonetically transcribed word list from East Tusom, an endangered Tibeto-Burman +# language of Northeast India. One speaker, 2,255 utterances, 51.8 minutes. +# Data: https://github.com/dmort27/tusom2021 +# Paper: https://www.isca-archive.org/interspeech_2021/mortensen21_interspeech.html +# License: the MIT License, in the LICENSE file of the data repo. +# +# Download instructions: +# git clone https://github.com/dmort27/tusom2021 ./.data/Tusom2021 +# git -C ./.data/Tusom2021 checkout e168dfb90f2b03d433742d5ba5ef5e5731686610 +# +# TODO: manual verification + +import os +import sys + +import panphon +import soundfile +import yaml + +sys.path.append(os.path.join(os.path.dirname(__file__), "..")) +from data_loaders.common import BaseDataset, interactive_flag_samples +from core.audio import audio_resample, TARGET_SAMPLE_RATE + +DATA_REPO = "https://github.com/dmort27/tusom2021" +DATA_DIR = os.path.join( + os.path.dirname(__file__), "..", "..", ".data", "Tusom2021", "data" +) +WAV_DIR = os.path.join(DATA_DIR, "wav") +SPLITS = ("train", "dev", "test", "all") +LABEL_FIELD = "no_tones" + + +def read_labels(name): + """The entries of one of the dataset's YAML files, by WAV file name.""" + with open(os.path.join(DATA_DIR, name), encoding="utf-8") as f: + return yaml.safe_load(f) + + +def read_wav(path): + """A WAV file as int16 at 16 kHz.""" + audio, rate = soundfile.read(path, dtype="int16") + return audio_resample(audio, rate, TARGET_SAMPLE_RATE) + + +class Tusom2021Dataset(BaseDataset): + """ + Valid splits are "train", "dev" and "test", from the dataset's own files, or "all". + + The text is the English gloss, since East Tusom has no writing system. + """ + + def __init__( + self, + split="all", + include_timestamps=False, + include_speaker_info=False, + include_text=False, + ): + super().__init__(split, include_timestamps, include_speaker_info, include_text) + + # The paper aligned the words by hand in Praat TextGrids, but the data has no TextGrid file. + assert not include_timestamps, "Tusom2021 has no phone timestamps" + + labels = read_labels("mapping.yml") + names = labels if split == "all" else read_labels(f"{split}.yml") + self.files = sorted(names) + self.labels = {name: labels[name] for name in self.files} + + # The folder also holds WAV files that mapping.yml does not label. They are not used. + wavs = [n for n in os.listdir(WAV_DIR) if n.endswith(".wav")] + self.skipped = {"wav_without_label": sum(n not in labels for n in wavs)} + + feature_table = panphon.FeatureTable() + self.vocab = { + phone + for name in self.files + for phone in feature_table.segs_safe(self._ipa(name)) + } + print( + f"Tusom2021 {split}: {len(self.files)} items, {self.skipped['wav_without_label']}" + " WAV files with no label skipped" + ) + + def _raw_label(self, name): + return self.labels[name][LABEL_FIELD] + + def _ipa(self, name): + # White space separates words in some labels and is no phone. VoxAngeles removes it the + # same way. str.split also takes out the control character U+001D that is in 6 labels. + return "".join(self._raw_label(name).split()) + + def __len__(self): + return len(self.files) + + def _get_ix(self, ix): + name = self.files[ix] + outputs = [self._ipa(name), read_wav(os.path.join(WAV_DIR, name))] + if self.include_speaker_info: + outputs.append( + { + "id": name.removesuffix(".wav"), + "recording": name.rsplit("-", 1)[0], + "speaker": "single female native speaker", + "language": "East Tusom", + "source": DATA_REPO, + "raw_label": self._raw_label(name), + } + ) + if self.include_text: + outputs.append(self.labels[name]["gloss"]) + return tuple(outputs) + + +if __name__ == "__main__": + dataset = Tusom2021Dataset(include_speaker_info=True, include_text=True) + print(len(dataset)) + interactive_flag_samples(dataset) From 1f2d1f6a219963107fc1f0f363cd03e761fb0ba1 Mon Sep 17 00:00:00 2001 From: RaunakGengiti2725 Date: Mon, 9 Nov 2026 10:23:02 +0000 Subject: [PATCH 2/9] Tusom2021: add a tones option for the three label forms The dataset writes each label in three ways, with no tones, with tones as combining marks, and with Chao tone letters. Work on phones wants the first and work on tone wants the others, so the form is now one argument. The default stays no tones, so every item of the default form is the same as in the previous commit. It is the form the paper's experiments use, and evaluate.py drops every tone mark before FER. --- scripts/data_loaders/Tusom2021.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/scripts/data_loaders/Tusom2021.py b/scripts/data_loaders/Tusom2021.py index 612b3ad7..20b0ff43 100644 --- a/scripts/data_loaders/Tusom2021.py +++ b/scripts/data_loaders/Tusom2021.py @@ -27,7 +27,8 @@ ) WAV_DIR = os.path.join(DATA_DIR, "wav") SPLITS = ("train", "dev", "test", "all") -LABEL_FIELD = "no_tones" +# The value of `tones` and the field of mapping.yml that it picks. +TONE_FIELDS = {"none": "no_tones", "diacritics": "tone_dias", "letters": "tone_letters"} def read_labels(name): @@ -47,6 +48,10 @@ class Tusom2021Dataset(BaseDataset): Valid splits are "train", "dev" and "test", from the dataset's own files, or "all". The text is the English gloss, since East Tusom has no writing system. + + `tones` picks the form of the label. "none" has no tones, "diacritics" writes them as + combining marks and "letters" as Chao tone letters. The default is "none" because the + paper's experiments use that form and evaluate.py drops every tone mark before FER. """ def __init__( @@ -55,12 +60,16 @@ def __init__( include_timestamps=False, include_speaker_info=False, include_text=False, + tones="none", ): super().__init__(split, include_timestamps, include_speaker_info, include_text) # The paper aligned the words by hand in Praat TextGrids, but the data has no TextGrid file. assert not include_timestamps, "Tusom2021 has no phone timestamps" + self.tones = tones + self.label_field = TONE_FIELDS[tones] + labels = read_labels("mapping.yml") names = labels if split == "all" else read_labels(f"{split}.yml") self.files = sorted(names) @@ -77,12 +86,13 @@ def __init__( for phone in feature_table.segs_safe(self._ipa(name)) } print( - f"Tusom2021 {split}: {len(self.files)} items, {self.skipped['wav_without_label']}" + f"Tusom2021 {split}, tones {tones}: {len(self.files)} items," + f" {self.skipped['wav_without_label']}" " WAV files with no label skipped" ) def _raw_label(self, name): - return self.labels[name][LABEL_FIELD] + return self.labels[name][self.label_field] def _ipa(self, name): # White space separates words in some labels and is no phone. VoxAngeles removes it the From c517ddcbc8287f0a19ece7378eda5101873aadd2 Mon Sep 17 00:00:00 2001 From: RaunakGengiti2725 Date: Mon, 9 Nov 2026 10:34:07 +0000 Subject: [PATCH 3/9] Tusom2021: fail with clear errors on missing or broken data Someone who has not downloaded the data, or whose copy is damaged, should get an error that names the file and gives the command that fixes it. A missing folder or YAML file now gives the git clone command, an unknown split or tone form lists the valid ones, and a WAV that the labels list but the disk does not have is named. soundfile returns a shorter clip from a WAV that was cut short, with no error, so the size field of the RIFF header is checked first. Every item of every split and form is the same as in the previous commit. --- scripts/data_loaders/Tusom2021.py | 56 ++++++++++++++++++++++++++++--- 1 file changed, 52 insertions(+), 4 deletions(-) diff --git a/scripts/data_loaders/Tusom2021.py b/scripts/data_loaders/Tusom2021.py index 20b0ff43..bb27e7ca 100644 --- a/scripts/data_loaders/Tusom2021.py +++ b/scripts/data_loaders/Tusom2021.py @@ -8,6 +8,8 @@ # git clone https://github.com/dmort27/tusom2021 ./.data/Tusom2021 # git -C ./.data/Tusom2021 checkout e168dfb90f2b03d433742d5ba5ef5e5731686610 # +# Tested on Nov 9, 2026, on the real files at that commit: every item of train, dev, test and all, +# in each of the three label forms. No person has yet listened to the clips against their labels. # TODO: manual verification import os @@ -26,6 +28,10 @@ os.path.dirname(__file__), "..", "..", ".data", "Tusom2021", "data" ) WAV_DIR = os.path.join(DATA_DIR, "wav") +DOWNLOAD = ( + f"git clone {DATA_REPO} ./.data/Tusom2021 &&" + " git -C ./.data/Tusom2021 checkout e168dfb90f2b03d433742d5ba5ef5e5731686610" +) SPLITS = ("train", "dev", "test", "all") # The value of `tones` and the field of mapping.yml that it picks. TONE_FIELDS = {"none": "no_tones", "diacritics": "tone_dias", "letters": "tone_letters"} @@ -33,13 +39,37 @@ def read_labels(name): """The entries of one of the dataset's YAML files, by WAV file name.""" - with open(os.path.join(DATA_DIR, name), encoding="utf-8") as f: - return yaml.safe_load(f) + path = os.path.join(DATA_DIR, name) + if not os.path.exists(path): + raise FileNotFoundError(f"{path} not found. Download the data with: {DOWNLOAD}") + try: + with open(path, encoding="utf-8") as f: + entries = yaml.safe_load(f) + except yaml.YAMLError as e: + raise ValueError( + f"Cannot parse {path}: {e}. Get it again with: {DOWNLOAD}" + ) from e + if not isinstance(entries, dict): + raise ValueError(f"{path} is not a YAML mapping. Get it again with: {DOWNLOAD}") + for wav, entry in entries.items(): + for field in ("gloss", *TONE_FIELDS.values()): + if not isinstance(entry, dict) or not isinstance(entry.get(field), str): + raise ValueError(f"Entry {wav} of {path} has no text field {field}") + return entries def read_wav(path): """A WAV file as int16 at 16 kHz.""" - audio, rate = soundfile.read(path, dtype="int16") + with open(path, "rb") as f: + header = f.read(12) + # soundfile would return a shorter clip from a file that was cut short, without any error. + # The size field of the RIFF header gives it away. It holds the file size minus 8 bytes. + if int.from_bytes(header[4:8], "little") + 8 != os.path.getsize(path): + raise ValueError(f"The WAV file {path} is cut short or is not a WAV file") + try: + audio, rate = soundfile.read(path, dtype="int16") + except soundfile.SoundFileError as e: + raise ValueError(f"Cannot decode the WAV file {path}: {e}") from e return audio_resample(audio, rate, TARGET_SAMPLE_RATE) @@ -67,16 +97,34 @@ def __init__( # The paper aligned the words by hand in Praat TextGrids, but the data has no TextGrid file. assert not include_timestamps, "Tusom2021 has no phone timestamps" + if split not in SPLITS: + raise ValueError(f"Unknown split {split}. Valid splits are {SPLITS}") + if tones not in TONE_FIELDS: + raise ValueError( + f"Unknown tones {tones}. Valid forms are {list(TONE_FIELDS)}" + ) self.tones = tones self.label_field = TONE_FIELDS[tones] labels = read_labels("mapping.yml") names = labels if split == "all" else read_labels(f"{split}.yml") + for name in names: + if name not in labels: + raise ValueError( + f"{name} is in {split}.yml but has no label in mapping.yml" + ) self.files = sorted(names) self.labels = {name: labels[name] for name in self.files} + found = os.listdir(WAV_DIR) if os.path.isdir(WAV_DIR) else [] + wavs = set(n for n in found if n.endswith(".wav")) + missing = [name for name in self.files if name not in wavs] + if missing: + raise FileNotFoundError( + f"{len(missing)} of the {len(self.files)} WAV files of split {split} are not in" + f" {WAV_DIR}, such as {missing[0]}. Download the data with: {DOWNLOAD}" + ) # The folder also holds WAV files that mapping.yml does not label. They are not used. - wavs = [n for n in os.listdir(WAV_DIR) if n.endswith(".wav")] self.skipped = {"wav_without_label": sum(n not in labels for n in wavs)} feature_table = panphon.FeatureTable() From 6440e3556e556667a417e5dd2d9fc057aec00d96 Mon Sep 17 00:00:00 2001 From: RaunakGengiti2725 Date: Mon, 9 Nov 2026 10:49:08 +0000 Subject: [PATCH 4/9] Tusom2021: add the dataset notes as docs/datasets/Tusom2021.md Alex asked for notes on each dataset, such as how much of the annotation was done by people or by machine, how the annotators were trained, and what cleaning was done or is still needed. These are the notes for Tusom2021. They sit next to the DoReCo notes that PR 20 proposes, so this place is only a proposal, and the file is easy to move. The notes list the labels that look wrong and the places where the paper and the data differ. The loader leaves those labels as they are, so Alex can decide. No code changes. --- docs/datasets/Tusom2021.md | 231 +++++++++++++++++++++++++++++++++++++ 1 file changed, 231 insertions(+) create mode 100644 docs/datasets/Tusom2021.md diff --git a/docs/datasets/Tusom2021.md b/docs/datasets/Tusom2021.md new file mode 100644 index 00000000..207b25a8 --- /dev/null +++ b/docs/datasets/Tusom2021.md @@ -0,0 +1,231 @@ +# Tusom2021 + +These notes are from Nov 9, 2026. Every number comes from the real data, the repo https://github.com/dmort27/tusom2021 at commit `e168dfb`, unless a line says otherwise. Facts from the paper give the page of the Interspeech 2021 PDF. Where the paper and the data disagree, both are given. What we could not check says not verified. + +## Words used below + +* A phone is one speech sound. +* A token is one recording of a word or short phrase. A type is one word or phrase. Most types here have three tokens. +* A label is the transcription of one token. `mapping.yml` gives each token three labels, one in each form. +* FER and PER are the two scores that the `evaluate` function in `scripts/eval/evaluate.py` returns. Both are error rates, so 0 is a perfect match. PER counts the character edits between the two raw strings. FER weighs the edits by sound features, after `preprocess_ipa` cleans both strings. +* A glottocode is a language id from Glottolog, a catalog of the world's languages. + +## Loader + +`scripts/data_loaders/Tusom2021.py`, class `Tusom2021Dataset`. + +* `split` is `train`, `dev`, `test` or `all`. The first three are the dataset's own files. +* `tones` is `none`, `diacritics` or `letters`, for the fields `no_tones`, `tone_dias` and `tone_letters`. The default is `none`. +* `include_timestamps=True` fails, since the data has no phone times. +* `include_speaker_info=True` gives a dict with `id`, `recording`, `speaker`, `language`, `source` and `raw_label`. `raw_label` is the exact field from `mapping.yml`. +* `include_text=True` gives the English gloss, since East Tusom has no writing system, page 3660. + +Why the default is `none`. Both experiments in the paper use that form, on pages 3662 and 3663. Tones also add nothing to FER today, since `preprocess_ipa` drops every tone mark. See Symbols the evaluation drops below. It is one argument to change. + +## Report + +| Item | Value | Source | +|---|---|---| +| Language | East Tusom, a Tangkhulic language of Manipur, India | Paper, page 3660 | +| Language codes | no `ISO 639-3` code, glottocode `east2902` | Paper, page 3660, and the Glottolog entry for Mortensen and Picone 2021 | +| Speakers | 1 | Paper, page 3661 | +| WAV files on disk | 2,392 | Data | +| Labels in `mapping.yml` | 2,255 | Data | +| Items, train, dev, test | 1,578, 230, 447 | Data, equal to Table 5 of the paper | +| WAV files with no label, skipped | 137 | Data | +| Audio minutes, train, dev, test, all | 36.49, 5.20, 10.13, 51.83 | Data, equal to Table 5 to one decimal | +| Clip seconds, all items | shortest 0.223, median 1.303, 95th percentile 2.121, longest 4.772 | Loader | +| Clips over 30 s | 0 | Loader | +| Phone times | none in the data | Data | +| Distinct panphon units | 59 with no tones, 61 with tone marks, 64 with tone letters | Loader | +| WAV format | all 2,392 are mono, 16 bit PCM, plain 44 byte header | Data | +| Sample rate | 2,173 files at 22,050 Hz, 219 at 16,000 Hz | Data | +| Load time, one pass over all 2,255 items | 3.7 s, 609 items per second, on the Linux VM from the Mac's shared folder | `Tusom2021Dataset` on Nov 9 | +| Setup time for all | 1.64 s, best of 3 | Same | +| Peak memory | 338 MB, the whole process with its imports | Same | + +Clip seconds per split. + +| Split | Shortest | Median | 95th percentile | Longest | +|---|---|---|---|---| +| train | 0.223 | 1.302 | 2.148 | 4.772 | +| dev | 0.682 | 1.321 | 1.987 | 2.863 | +| test | 0.588 | 1.285 | 2.124 | 3.557 | + +## Speakers + +There is one speaker. The paper says this on page 3661. + +``` +The data were collected from one native female speaker of East Tusom in her late 20s. She did not grow up in Tusom village but spoke the language at home, with her family, and when she stayed with her extended family in Tusom. +``` + +The speaker has no code in the data. The loader gives every item the same `speaker` value. With one speaker, this data can say nothing about how a model handles different speakers. + +## Speech type and recording + +* Elicited words and short phrases from a comparative word list of about 2,400 items, page 3662. +* The first author gave an English word and the speaker answered in East Tusom, three times, page 3662. +* Recorded in 2004, page 3661, on an inexpensive lavalier microphone into the analog jack of a laptop running Audacity, page 3662. +* The paper warns of noise on page 3660. These are its words. + +``` +The recording equipment was optimized for price and portability, rather than acoustic fidelity and there is considerable background noise (from air conditioning and small children). +``` + +* The WAV names have 42 stems with labeled items, such as `animals1` or `verb14`. The paper says each tranche of words was recorded in one session, page 3662. That the stems are those sessions is likely, not verified. The loader returns the stem as `recording`. +* Loudness differs much between stems. In 12 of the 42, the median clip is under minus 40 dB, and they hold 665 of the 2,255 items. They are `bp1` to `bp10`, `numbers` and `numbers2`. The median of their medians is minus 44.2 dB, and of the other stems minus 30.5 dB. +* No clip is silent. In 38 clips, the loudest 20 ms frame is under minus 40 dB. This check can find silence and clipping. It cannot show that a clip holds the word in its label. + +## License and how to get the data + +The data repo has an MIT License, copyright 2021 David R. Mortensen, in its `LICENSE` file. Nobody has to sign anything to download it. The commands are in the header of the loader. + +The MIT License is written for software. Neither the paper nor the repo says whether it is meant to cover the recordings, or what the speaker agreed to. We make no legal judgment on that. It is one of the questions for Alex. + +## Citation + +The project page at https://llab-cmu.github.io/projects/tusom-project.html asks users to cite the Interspeech version, not the arXiv one. + +``` +David R. Mortensen, Jordan Picone, Xinjian Li, and Kathleen Siminyu. Tusom2021: A Phonetically Transcribed Speech Dataset from an Endangered Language for Universal Phone Recognition Experiments. In Proc. Interspeech 2021, pages 3660-3664. doi:10.21437/Interspeech.2021-1435 +``` + +## How the labels were made + +### In short + +People wrote these labels. No G2P was used, and no forced alignment. One person with graduate training in phonetics and field linguistics wrote them first, over several passes. A second person checked all of them. The paper gives no measure of agreement. These are the paper's words, from page 3662. + +``` +The first author, who had graduate training in phonetics and field linguistics, elicited an item from the speaker, then attempted to imitate it until the speaker confirmed that it was correctly produced, then transcribed it. +``` + +``` +The transcriptions and the recordings were subsequently aligned manually, using Praat TextGrids [9]. The first author then made a pass over the transcriptions. Subsequently, the first author made a partial second pass, correcting transcriptions of tone. The second author made a global pass, checking all transcriptions for correctness and consistency. Final consistency checks were done using a combination of automatic and manual methods (using Python scripts to extract all tokens transcribed with a particular phone, then using auditory inspection and acoustic analysis—using Praat—to winnow out distinctions that had been inconsistently noted in the previous pass, such as voicing in plosives). +``` + +``` +We estimate that the production of the transcriptions alone, leaving aside elicitation, recording, and segmentation, took over 200 hours. +``` + +### Human or machine + +Human. The only machine part the paper names is the scripts that pulled out every token with a given phone, so that a person could check them by ear and in Praat, page 3662. + +### Training of the people involved + +* The first author had graduate training in phonetics and field linguistics, page 3662. +* The second author is listed under the Department of Linguistics, University of Pittsburgh, page 3660. The paper does not state this person's training. + +### Number of annotators and agreement + +Two people. One wrote and corrected the labels. The other checked all of them. The paper reports no agreement figure. So this dataset cannot measure agreement between annotators, which issue #10 asks about. + +### Words first written at elicitation + +The first transcription of a word was made before the recording, page 3662. Later passes corrected it. The paper does not say how many labels each pass changed. Tokens of one type can differ, on purpose, as the paper says on page 3662. + +``` +In some cases, tokens of a type are not phonetically identical (and are not identically transcribed). +``` + +In the data, 34 groups of tokens from one stem with one gloss have more than one `tone_dias` form, out of 721 groups with two or more tokens. + +## Transcription conventions + +* Phones, not phonemes, page 3660. The paper does not use the words broad or narrow. +* IPA, as Unicode text. The joined sounds `t͡s` and `t͡ɕ` have a tie bar, 335 in all. Aspiration is the letter `ʰ`, and a nasal vowel is a vowel with `U+0303` after it. +* Two vowels in a row are vowel pairs, as Table 4 lists them, with no mark between them. +* Tones, three in all, high, low and falling, page 3660. `tone_dias` writes them as the combining marks `U+0301`, `U+0300` and `U+0302`. `tone_letters` writes them as Chao letters after each syllable, such as `˥˧`. +* No stress marks and no length marks. +* 340 labels have a space between words. + +## Cleaning done by the authors + +The final checks on page 3662 removed distinctions that had been marked unevenly, such as voicing in plosives. See the quote above. The paper also says that an uncorrected subset of this data was used in an earlier paper, page 3661. + +## Cleaning done in this loader + +* 137 WAV files have no label, so they are skipped and counted, in `self.skipped`. +* White space comes out of the IPA. This changes 343 labels. 340 have spaces between words. 6 have the control character `U+001D`, and 3 of those also have a space. The repo's training code and `preprocess_ipa` also remove spaces, and PER would count them. The exact label is still in `raw_label`. +* No Unicode normalization. It would turn `a` followed by `U+0303` into the single letter `ã`, which `preprocess_ipa` drops whole. +* No phone is changed. No audio is trimmed or made louder. Audio is read with `soundfile` and made 16 kHz with the repo's `audio_resample`. + +## Cleaning still needed + +Each of these is left in, so that nobody's research labels change quietly. + +* `verb17-19.wav` has the label `ɑ` in all three forms. The tokens next to it, with the same gloss, high, have `kət͡ɕʰuə`. It looks like a typing error. It is in train. +* `bp9-85.wav` is 0.223 s long and almost silent, with a peak of 0.0064 of full scale, for a label of 7 sounds. It is in train. +* 7 labels of `no_tones` still have tone on a vowel, 10 accented vowels in all. They are `bp12-6` to `bp12-9`, with `á`, and `bp2-70` to `bp2-72`, with `á` and `ỳ`. `preprocess_ipa` drops these vowels whole. +* `g` is the plain letter in the 3 labels `animals1-22` to `animals1-24`, instead of the IPA letter `U+0261`. `preprocess_ipa` accepts it. +* `ʃ` appears in the 3 labels `verb13-38` to `verb13-40`, where the rest of the data has `ɕ`. `ɨ` appears 16 times next to the common `ɯ`. Whether these are real differences is not verified. +* `bp10-84.wav`, which has a label, is byte for byte the same file as `bp10-74.wav`, which has none. No two labeled items share audio. +* The 137 unlabeled files could be labeled. All 137 are in `data/wav/transcriptions.tsv`, an older draft with 774 rows. Its text equals `no_tones` in only 116 of the 637 rows that `mapping.yml` also has. It writes `ʃ` and `ɨ` where `mapping.yml` writes `ɕ` and `ɯ`. Why the 137 were left out is not stated. 66 of them have a number one more than a multiple of 4, which would fit the first of four tokens. Their pitch, by a rough estimate, is like that of the labeled clips, with a median near 210 Hz, so they are probably the same speaker. The loader does not read this file. + +## Splits + +* `partition_data.py`, run on a copy with the pinned Python and packages, rebuilds `train.yml`, `dev.yml` and `test.yml` byte for byte. It groups tokens by their `tone_dias` label, shuffles the groups with seed 256, and takes the first 70% for train, then 10% for dev, and the rest for test. +* So no `tone_dias` label is in two splits. 10 `no_tones` labels are, since words that differ only in tone can fall apart. They are `kəka`, `kətxuə`, `kətʰuə`, `kəxui`, `kʰəmɯə`, `kʰənt͡sɯ`, `kʰəŋuə`, `t͡ɕuŋkʰəma`, `ʔikətuəpi` and `ʔɯkʰr̥u`. With `tones="none"`, a few test labels also occur in train. +* The split is by label, not by speaker or session. 37 stems are in both train and test. For a model that never saw this language, this does not matter. For fine tuning it does. + +## Where the paper and the data differ + +* The paper's Section 3 says 2,393 tokens on page 3662. The abstract and Table 5 say 2,255, which is the number of labels. The disk has 2,392 WAV files. `data/wav` has 2,393 files if `transcriptions.tsv` is counted, which may be where that number comes from. Not verified. +* The paper says the recordings are at 22.05 kHz, page 3662. 219 files are at 16 kHz, all of the stems `bp4`, `bp5` and `bp6`. +* Table 5 gives 15,132, 2,133 and 4,283 phones. `partition_data.py` prints 15,136, 2,133 and 4,289 today. The differences, 4 and 6, are exactly the precomposed vowels `á` and `ỳ` in the `tone_dias` labels of train and test. panphon 0.22.2 counts each as two units. Those counts also count every space as one unit, 333, 38 and 76 of them. Why an older panphon counted differently is not verified. + +## Symbols the evaluation drops + +`evaluate(ipa, ipa)` gives PER 0 and FER 0 on every item of every form, and it never raises. + +| Form | Code points | Lost in `preprocess_ipa` | Share | Labels affected | PER of a perfect prediction with no tones | +|---|---|---|---|---|---| +| `no_tones` | 16,949 | 10 | 0.06% | 7 | 0 | +| `tone_dias` | 23,341 | 6,405 | 27.44% | 2,241 | 0.2738 | +| `tone_letters` | 29,733 | 12,835 | 43.17% | 2,241 | 0.4275 | + +* The loss in `no_tones` is the 10 accented vowels listed above, under finding F7. +* Every tone mark is lost in the two tone forms. So FER cannot see tone today, and PER punishes a model for every tone mark it does not write. +* In `tone_letters`, `preprocess_ipa` also loses `U+0303`, which marks a nasal vowel, 38 times, and the syllable mark `U+0329` 3 times. In `tone_dias`, it loses `U+0303` 3 times. +* `simplify_ipa` leaves tone marks in 2,241 labels of `tone_dias` and 2,173 of `tone_letters`, as in finding F10. +* The cleaned labels have 1.166 code points per unit in `no_tones`, finding F12. + +## Resampling + +`audio_resample` has no low pass filter, finding F6, so sound above 8 kHz folds back at 16 kHz. In the 2,173 files at 22,050 Hz, the share of energy above 8 kHz has a median of 0.00053, about minus 33 dB, and a 95th percentile of 0.015. Its largest value is 0.227. + +## What it is good for + +* A test of whether a model hears the phones of a language it has never seen. The labels were written by people who knew phonetics. +* Tusom2021 is not listed in the training data of `KoelLabs/xlsr-english-01`, and its base model's card names Common Voice with no list of languages. We read those cards on Nov 7. The pages could not be reached on Nov 9, so this was not checked again. Whether Common Voice has this language is not verified. +* A small tuning set. The paper's best PER after tuning is 33%, from a baseline of 72%, page 3663. Its zero shot results are on page 3662. + +``` +test eng 88.4% 9.6% 14.6% 64.2% + lg_ind 71.9% 2.5% 24.0% 45.4% +all eng 88.9% 9.8% 14.7% 64.3% + lg_ind 69.2% 3.2% 23.7% 42.4% +``` + +Those rows are from Table 6, with the columns PER, Add, Del and Sub. They use `no_tones` with rare phones replaced by similar common ones, page 3662, so they are not scores on these raw labels. + +## What the data does not cover + +* Other speakers, men, other ages. +* Sentences or connected speech. +* Any other recording setup. +* Phone times. The paper says the words were aligned by hand in Praat, page 3662, and the release has no TextGrid file. + +## How we checked + +Scripts are kept outside this PR. They read every label and every WAV file. The loader's own tests ran on every item of every split and form, and compared each item with `mapping.yml` and with its WAV file. Results are the same under two hash seeds and between commits. Nobody has listened to the clips against their labels yet, so we do not claim that the audio matches the labels. + +## Sources + +* The data repo, https://github.com/dmort27/tusom2021, commit `e168dfb90f2b03d433742d5ba5ef5e5731686610`, read Nov 9, 2026. +* The paper as a PDF, https://www.isca-archive.org/interspeech_2021/mortensen21_interspeech.pdf, read Nov 9, 2026. +* Glottolog, https://glottolog.org/resource/reference/id/636054, read Nov 9, 2026. +* The project page, https://llab-cmu.github.io/projects/tusom-project.html, read Nov 4, 2026. +* The model cards, https://huggingface.co/KoelLabs/xlsr-english-01 and https://huggingface.co/facebook/wav2vec2-xlsr-53-espeak-cv-ft, read through a web reader on Nov 7, 2026. From 76f562433a5baf5046ce9f4366e7ef3ff2da88f4 Mon Sep 17 00:00:00 2001 From: RaunakGengiti2725 Date: Mon, 9 Nov 2026 12:12:25 +0000 Subject: [PATCH 5/9] Tusom2021: make errors say what fixes them and count the cleaning A review of the first four commits found places to tighten. Every error about the data files now says how to get or repair them, from the repo root. The loader counts the labels it takes white space out of and prints that count, since the IPA differs from mapping.yml for those items. A WAV that is not mono 16 bit audio now fails, and so does a blank label. include_timestamps=True raises ValueError in place of an assert, which python -O would skip. Every item of every split and form is the same as in the previous commit. --- scripts/data_loaders/Tusom2021.py | 60 +++++++++++++++++++------------ 1 file changed, 37 insertions(+), 23 deletions(-) diff --git a/scripts/data_loaders/Tusom2021.py b/scripts/data_loaders/Tusom2021.py index bb27e7ca..07863dfc 100644 --- a/scripts/data_loaders/Tusom2021.py +++ b/scripts/data_loaders/Tusom2021.py @@ -1,4 +1,4 @@ -# Tusom2021: a phonetically transcribed word list from East Tusom, an endangered Tibeto-Burman +# Tusom2021, a phonetically transcribed word list from East Tusom, an endangered Tibeto-Burman # language of Northeast India. One speaker, 2,255 utterances, 51.8 minutes. # Data: https://github.com/dmort27/tusom2021 # Paper: https://www.isca-archive.org/interspeech_2021/mortensen21_interspeech.html @@ -8,8 +8,8 @@ # git clone https://github.com/dmort27/tusom2021 ./.data/Tusom2021 # git -C ./.data/Tusom2021 checkout e168dfb90f2b03d433742d5ba5ef5e5731686610 # -# Tested on Nov 9, 2026, on the real files at that commit: every item of train, dev, test and all, -# in each of the three label forms. No person has yet listened to the clips against their labels. +# Tested on Nov 9, 2026, on the real files at that commit. Every item of train, dev, test and all +# was checked in each of the three label forms. No person has listened to the clips yet. # TODO: manual verification import os @@ -28,9 +28,11 @@ os.path.dirname(__file__), "..", "..", ".data", "Tusom2021", "data" ) WAV_DIR = os.path.join(DATA_DIR, "wav") -DOWNLOAD = ( - f"git clone {DATA_REPO} ./.data/Tusom2021 &&" - " git -C ./.data/Tusom2021 checkout e168dfb90f2b03d433742d5ba5ef5e5731686610" +# Added to every error about the data files, so that the error says what fixes it. +FIX = ( + f"From the repo root, get the data with git clone {DATA_REPO} ./.data/Tusom2021" + " and git -C ./.data/Tusom2021 checkout e168dfb90f2b03d433742d5ba5ef5e5731686610," + " or repair a damaged copy with git -C ./.data/Tusom2021 checkout -- data" ) SPLITS = ("train", "dev", "test", "all") # The value of `tones` and the field of mapping.yml that it picks. @@ -41,20 +43,19 @@ def read_labels(name): """The entries of one of the dataset's YAML files, by WAV file name.""" path = os.path.join(DATA_DIR, name) if not os.path.exists(path): - raise FileNotFoundError(f"{path} not found. Download the data with: {DOWNLOAD}") + raise FileNotFoundError(f"{path} not found. {FIX}") try: with open(path, encoding="utf-8") as f: entries = yaml.safe_load(f) except yaml.YAMLError as e: - raise ValueError( - f"Cannot parse {path}: {e}. Get it again with: {DOWNLOAD}" - ) from e + raise ValueError(f"Cannot parse {path}. {e}. {FIX}") from e if not isinstance(entries, dict): - raise ValueError(f"{path} is not a YAML mapping. Get it again with: {DOWNLOAD}") + raise ValueError(f"{path} is not a YAML mapping. {FIX}") for wav, entry in entries.items(): for field in ("gloss", *TONE_FIELDS.values()): - if not isinstance(entry, dict) or not isinstance(entry.get(field), str): - raise ValueError(f"Entry {wav} of {path} has no text field {field}") + text = entry.get(field) if isinstance(entry, dict) else None + if not isinstance(text, str) or not text.strip(): + raise ValueError(f"Entry {wav} of {path} has no text in {field}. {FIX}") return entries @@ -65,11 +66,17 @@ def read_wav(path): # soundfile would return a shorter clip from a file that was cut short, without any error. # The size field of the RIFF header gives it away. It holds the file size minus 8 bytes. if int.from_bytes(header[4:8], "little") + 8 != os.path.getsize(path): - raise ValueError(f"The WAV file {path} is cut short or is not a WAV file") + raise ValueError(f"The WAV file {path} is cut short or is not a WAV. {FIX}") + # soundfile reads the header, where core/audio.py assumes that samples start at byte 44. try: - audio, rate = soundfile.read(path, dtype="int16") + with soundfile.SoundFile(path) as f: + if f.channels != 1 or f.subtype != "PCM_16" or f.frames == 0: + raise ValueError( + f"The WAV file {path} is not mono 16 bit audio with samples. {FIX}" + ) + audio, rate = f.read(dtype="int16"), f.samplerate except soundfile.SoundFileError as e: - raise ValueError(f"Cannot decode the WAV file {path}: {e}") from e + raise ValueError(f"Cannot decode the WAV file {path}. {e}. {FIX}") from e return audio_resample(audio, rate, TARGET_SAMPLE_RATE) @@ -94,9 +101,9 @@ def __init__( ): super().__init__(split, include_timestamps, include_speaker_info, include_text) - # The paper aligned the words by hand in Praat TextGrids, but the data has no TextGrid file. - assert not include_timestamps, "Tusom2021 has no phone timestamps" - + if include_timestamps: + # The paper aligned the words by hand in Praat, but the data has no TextGrid file. + raise ValueError("Tusom2021 has no phone timestamps") if split not in SPLITS: raise ValueError(f"Unknown split {split}. Valid splits are {SPLITS}") if tones not in TONE_FIELDS: @@ -111,7 +118,7 @@ def __init__( for name in names: if name not in labels: raise ValueError( - f"{name} is in {split}.yml but has no label in mapping.yml" + f"{name} is in {split}.yml but has no label in mapping.yml. {FIX}" ) self.files = sorted(names) self.labels = {name: labels[name] for name in self.files} @@ -122,11 +129,18 @@ def __init__( if missing: raise FileNotFoundError( f"{len(missing)} of the {len(self.files)} WAV files of split {split} are not in" - f" {WAV_DIR}, such as {missing[0]}. Download the data with: {DOWNLOAD}" + f" {WAV_DIR}, such as {missing[0]}. {FIX}" ) # The folder also holds WAV files that mapping.yml does not label. They are not used. self.skipped = {"wav_without_label": sum(n not in labels for n in wavs)} + # Counted because the IPA differs from the label in mapping.yml for these items. + self.cleaned = { + "label_with_white_space": sum( + self._ipa(name) != self._raw_label(name) for name in self.files + ) + } + feature_table = panphon.FeatureTable() self.vocab = { phone @@ -135,8 +149,8 @@ def __init__( } print( f"Tusom2021 {split}, tones {tones}: {len(self.files)} items," - f" {self.skipped['wav_without_label']}" - " WAV files with no label skipped" + f" white space removed from {self.cleaned['label_with_white_space']} labels," + f" {self.skipped['wav_without_label']} WAV files with no label skipped" ) def _raw_label(self, name): From 6bdb6167990f928b304a69e20568e87529dce71f Mon Sep 17 00:00:00 2001 From: RaunakGengiti2725 Date: Mon, 9 Nov 2026 12:23:29 +0000 Subject: [PATCH 6/9] Tusom2021: correct the notes where a review found them too sure A review checked the notes against the paper and the data. Some lines said more than the sources do, such as that no G2P was used, where the paper only names none. The older transcriptions.tsv is shifted against mapping.yml in some stems, so it can only label the 137 unlabeled files with listening. Numbers of findings that only we know are replaced by the facts, and long sentences are split. No code changes. --- docs/datasets/Tusom2021.md | 51 +++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/docs/datasets/Tusom2021.md b/docs/datasets/Tusom2021.md index 207b25a8..3405ccbc 100644 --- a/docs/datasets/Tusom2021.md +++ b/docs/datasets/Tusom2021.md @@ -5,7 +5,7 @@ These notes are from Nov 9, 2026. Every number comes from the real data, the rep ## Words used below * A phone is one speech sound. -* A token is one recording of a word or short phrase. A type is one word or phrase. Most types here have three tokens. +* A token is one spoken instance of a word or short phrase, in one WAV file. A type is one word or phrase. Most types here have three tokens. * A label is the transcription of one token. `mapping.yml` gives each token three labels, one in each form. * FER and PER are the two scores that the `evaluate` function in `scripts/eval/evaluate.py` returns. Both are error rates, so 0 is a perfect match. PER counts the character edits between the two raw strings. FER weighs the edits by sound features, after `preprocess_ipa` cleans both strings. * A glottocode is a language id from Glottolog, a catalog of the world's languages. @@ -20,7 +20,7 @@ These notes are from Nov 9, 2026. Every number comes from the real data, the rep * `include_speaker_info=True` gives a dict with `id`, `recording`, `speaker`, `language`, `source` and `raw_label`. `raw_label` is the exact field from `mapping.yml`. * `include_text=True` gives the English gloss, since East Tusom has no writing system, page 3660. -Why the default is `none`. Both experiments in the paper use that form, on pages 3662 and 3663. Tones also add nothing to FER today, since `preprocess_ipa` drops every tone mark. See Symbols the evaluation drops below. It is one argument to change. +Why the default is `none`. Both experiments in the paper use that form, on pages 3662 and 3663. Tones also add nothing to FER today, since `preprocess_ipa` drops every tone mark. See Symbols the evaluation drops below. There is one cost. With this form, 10 labels are in two splits, as Splits below says. The default is one argument to change. ## Report @@ -40,8 +40,8 @@ Why the default is `none`. Both experiments in the paper use that form, on pages | Distinct panphon units | 59 with no tones, 61 with tone marks, 64 with tone letters | Loader | | WAV format | all 2,392 are mono, 16 bit PCM, plain 44 byte header | Data | | Sample rate | 2,173 files at 22,050 Hz, 219 at 16,000 Hz | Data | -| Load time, one pass over all 2,255 items | 3.7 s, 609 items per second, on the Linux VM from the Mac's shared folder | `Tusom2021Dataset` on Nov 9 | -| Setup time for all | 1.64 s, best of 3 | Same | +| Load time, one pass over all 2,255 items | 3.6 s, 621 items per second, on the Linux VM from the Mac's shared folder | `Tusom2021Dataset` on Nov 9 | +| Setup time for all | 1.68 s, best of 3 | Same | | Peak memory | 338 MB, the whole process with its imports | Same | Clip seconds per split. @@ -67,7 +67,7 @@ The speaker has no code in the data. The loader gives every item the same `speak * Elicited words and short phrases from a comparative word list of about 2,400 items, page 3662. * The first author gave an English word and the speaker answered in East Tusom, three times, page 3662. * Recorded in 2004, page 3661, on an inexpensive lavalier microphone into the analog jack of a laptop running Audacity, page 3662. -* The paper warns of noise on page 3660. These are its words. +* The paper describes the noise on page 3660. These are its words. ``` The recording equipment was optimized for price and portability, rather than acoustic fidelity and there is considerable background noise (from air conditioning and small children). @@ -75,13 +75,13 @@ The recording equipment was optimized for price and portability, rather than aco * The WAV names have 42 stems with labeled items, such as `animals1` or `verb14`. The paper says each tranche of words was recorded in one session, page 3662. That the stems are those sessions is likely, not verified. The loader returns the stem as `recording`. * Loudness differs much between stems. In 12 of the 42, the median clip is under minus 40 dB, and they hold 665 of the 2,255 items. They are `bp1` to `bp10`, `numbers` and `numbers2`. The median of their medians is minus 44.2 dB, and of the other stems minus 30.5 dB. -* No clip is silent. In 38 clips, the loudest 20 ms frame is under minus 40 dB. This check can find silence and clipping. It cannot show that a clip holds the word in its label. +* No clip is all zeros. In 38 clips, the loudest 20 ms frame is under minus 40 dB. This check can find silence and clipping. It cannot show that a clip holds the word in its label. ## License and how to get the data The data repo has an MIT License, copyright 2021 David R. Mortensen, in its `LICENSE` file. Nobody has to sign anything to download it. The commands are in the header of the loader. -The MIT License is written for software. Neither the paper nor the repo says whether it is meant to cover the recordings, or what the speaker agreed to. We make no legal judgment on that. It is one of the questions for Alex. +The MIT License is written for software. Neither the paper nor the repo says whether it is meant to cover the recordings, or what the speaker agreed to. We make no legal judgment on that. ## Citation @@ -95,7 +95,7 @@ David R. Mortensen, Jordan Picone, Xinjian Li, and Kathleen Siminyu. Tusom2021: ### In short -People wrote these labels. No G2P was used, and no forced alignment. One person with graduate training in phonetics and field linguistics wrote them first, over several passes. A second person checked all of them. The paper gives no measure of agreement. These are the paper's words, from page 3662. +People wrote these labels. The paper names no G2P step and no forced alignment, and East Tusom has no writing system to convert from, page 3660. One person with graduate training in phonetics and field linguistics wrote them first, over several passes. A second person checked all of them. The paper gives no measure of agreement. These are the paper's words, from page 3662. ``` The first author, who had graduate training in phonetics and field linguistics, elicited an item from the speaker, then attempted to imitate it until the speaker confirmed that it was correctly produced, then transcribed it. @@ -111,7 +111,7 @@ We estimate that the production of the transcriptions alone, leaving aside elici ### Human or machine -Human. The only machine part the paper names is the scripts that pulled out every token with a given phone, so that a person could check them by ear and in Praat, page 3662. +Human, as far as the paper says. The only machine part it names is a set of scripts, on page 3662. They pulled out every token with a given phone, so that a person could check those tokens by ear and in Praat. ### Training of the people involved @@ -120,23 +120,23 @@ Human. The only machine part the paper names is the scripts that pulled out ever ### Number of annotators and agreement -Two people. One wrote and corrected the labels. The other checked all of them. The paper reports no agreement figure. So this dataset cannot measure agreement between annotators, which issue #10 asks about. +The paper names two people. One wrote and corrected the labels. The other checked all of them. It does not say who did the final checks. It reports no agreement figure. So this dataset cannot measure agreement between annotators, which issue #10 of this repo asks about. ### Words first written at elicitation -The first transcription of a word was made before the recording, page 3662. Later passes corrected it. The paper does not say how many labels each pass changed. Tokens of one type can differ, on purpose, as the paper says on page 3662. +The first transcription of a word was made before the recording, page 3662. Later passes corrected it. The paper does not say how many labels each pass changed. Tokens of one type can differ, as the paper says on page 3662. ``` In some cases, tokens of a type are not phonetically identical (and are not identically transcribed). ``` -In the data, 34 groups of tokens from one stem with one gloss have more than one `tone_dias` form, out of 721 groups with two or more tokens. +In the data, 721 groups of two or more tokens share a stem and a gloss. 34 of them have more than one `tone_dias` form. In 11 of the 34, each form has three or more tokens, so those look like different words with one gloss. The others look like real differences between tokens, or errors, such as `verb17-19.wav` below. ## Transcription conventions * Phones, not phonemes, page 3660. The paper does not use the words broad or narrow. * IPA, as Unicode text. The joined sounds `t͡s` and `t͡ɕ` have a tie bar, 335 in all. Aspiration is the letter `ʰ`, and a nasal vowel is a vowel with `U+0303` after it. -* Two vowels in a row are vowel pairs, as Table 4 lists them, with no mark between them. +* Two vowels in a row have no mark between them. * Tones, three in all, high, low and falling, page 3660. `tone_dias` writes them as the combining marks `U+0301`, `U+0300` and `U+0302`. `tone_letters` writes them as Chao letters after each syllable, such as `˥˧`. * No stress marks and no length marks. * 340 labels have a space between words. @@ -148,7 +148,7 @@ The final checks on page 3662 removed distinctions that had been marked unevenly ## Cleaning done in this loader * 137 WAV files have no label, so they are skipped and counted, in `self.skipped`. -* White space comes out of the IPA. This changes 343 labels. 340 have spaces between words. 6 have the control character `U+001D`, and 3 of those also have a space. The repo's training code and `preprocess_ipa` also remove spaces, and PER would count them. The exact label is still in `raw_label`. +* White space comes out of the IPA. This changes 343 labels, and the count of each split is in `self.cleaned`. 340 have spaces between words. 6 have the control character `U+001D`, and 3 of those also have a space. The repo's training code and `preprocess_ipa` also remove spaces, and PER would count them. The exact label is still in `raw_label`. * No Unicode normalization. It would turn `a` followed by `U+0303` into the single letter `ã`, which `preprocess_ipa` drops whole. * No phone is changed. No audio is trimmed or made louder. Audio is read with `soundfile` and made 16 kHz with the repo's `audio_resample`. @@ -158,23 +158,24 @@ Each of these is left in, so that nobody's research labels change quietly. * `verb17-19.wav` has the label `ɑ` in all three forms. The tokens next to it, with the same gloss, high, have `kət͡ɕʰuə`. It looks like a typing error. It is in train. * `bp9-85.wav` is 0.223 s long and almost silent, with a peak of 0.0064 of full scale, for a label of 7 sounds. It is in train. -* 7 labels of `no_tones` still have tone on a vowel, 10 accented vowels in all. They are `bp12-6` to `bp12-9`, with `á`, and `bp2-70` to `bp2-72`, with `á` and `ỳ`. `preprocess_ipa` drops these vowels whole. +* 7 labels of `no_tones` still have tone on a vowel, 10 accented vowels in all. They are `bp12-6` to `bp12-9`, with `á`, and `bp2-70` to `bp2-72`, with `á` and `ỳ`. `preprocess_ipa` drops these vowels whole. They also put two bare tone marks, `U+0300` and `U+0301`, in `vocab` for the form with no tones. * `g` is the plain letter in the 3 labels `animals1-22` to `animals1-24`, instead of the IPA letter `U+0261`. `preprocess_ipa` accepts it. * `ʃ` appears in the 3 labels `verb13-38` to `verb13-40`, where the rest of the data has `ɕ`. `ɨ` appears 16 times next to the common `ɯ`. Whether these are real differences is not verified. * `bp10-84.wav`, which has a label, is byte for byte the same file as `bp10-74.wav`, which has none. No two labeled items share audio. -* The 137 unlabeled files could be labeled. All 137 are in `data/wav/transcriptions.tsv`, an older draft with 774 rows. Its text equals `no_tones` in only 116 of the 637 rows that `mapping.yml` also has. It writes `ʃ` and `ɨ` where `mapping.yml` writes `ɕ` and `ɯ`. Why the 137 were left out is not stated. 66 of them have a number one more than a multiple of 4, which would fit the first of four tokens. Their pitch, by a rough estimate, is like that of the labeled clips, with a median near 210 Hz, so they are probably the same speaker. The loader does not read this file. +* The 137 unlabeled files could be labeled, but only by listening. Why they were left out is not stated. All 137 are in `data/wav/transcriptions.tsv`, which looks like an earlier draft, with 774 rows. It writes `ʃ` and `ɨ` where `mapping.yml` writes `ɕ` and `ɯ`. `mapping.yml` has 637 of its rows. With those letters and a few marks folded together, 318 rows are equal and 124 are a different word. For 116 of those 124, the same word is in `mapping.yml` within 10 file numbers, in 8 stems. So the draft's rows are shifted in those stems, and it cannot be trusted file by file. 66 of the 137 have a number one more than a multiple of 4, which would fit the first of four tokens. Their pitch, by a rough estimate, is like that of the labeled clips. Its median is near 210 Hz. So they are probably the same speaker. The loader does not read this file. ## Splits -* `partition_data.py`, run on a copy with the pinned Python and packages, rebuilds `train.yml`, `dev.yml` and `test.yml` byte for byte. It groups tokens by their `tone_dias` label, shuffles the groups with seed 256, and takes the first 70% for train, then 10% for dev, and the rest for test. -* So no `tone_dias` label is in two splits. 10 `no_tones` labels are, since words that differ only in tone can fall apart. They are `kəka`, `kətxuə`, `kətʰuə`, `kəxui`, `kʰəmɯə`, `kʰənt͡sɯ`, `kʰəŋuə`, `t͡ɕuŋkʰəma`, `ʔikətuəpi` and `ʔɯkʰr̥u`. With `tones="none"`, a few test labels also occur in train. +* `partition_data.py`, run on a copy with the pinned Python and packages, rebuilds `train.yml`, `dev.yml` and `test.yml` byte for byte. It groups tokens by their `tone_dias` label and shuffles the groups with seed 256. The first 70% of the groups are train, the next 10% dev, and the rest test. +* So no `tone_dias` label is in two splits. 10 `no_tones` labels are, since words that differ only in tone can land in different splits. They are `kəka`, `kətxuə`, `kətʰuə`, `kəxui`, `kʰəmɯə`, `kʰənt͡sɯ`, `kʰəŋuə`, `t͡ɕuŋkʰəma`, `ʔikətuəpi` and `ʔɯkʰr̥u`. With `tones="none"`, a few test labels also occur in train. * The split is by label, not by speaker or session. 37 stems are in both train and test. For a model that never saw this language, this does not matter. For fine tuning it does. ## Where the paper and the data differ * The paper's Section 3 says 2,393 tokens on page 3662. The abstract and Table 5 say 2,255, which is the number of labels. The disk has 2,392 WAV files. `data/wav` has 2,393 files if `transcriptions.tsv` is counted, which may be where that number comes from. Not verified. * The paper says the recordings are at 22.05 kHz, page 3662. 219 files are at 16 kHz, all of the stems `bp4`, `bp5` and `bp6`. -* Table 5 gives 15,132, 2,133 and 4,283 phones. `partition_data.py` prints 15,136, 2,133 and 4,289 today. The differences, 4 and 6, are exactly the precomposed vowels `á` and `ỳ` in the `tone_dias` labels of train and test. panphon 0.22.2 counts each as two units. Those counts also count every space as one unit, 333, 38 and 76 of them. Why an older panphon counted differently is not verified. +* Table 5 gives 15,132, 2,133 and 4,283 phones. `partition_data.py` prints 15,136, 2,133 and 4,289 today. The differences, 4 and 6, are exactly the precomposed vowels `á` and `ỳ` in the `tone_dias` labels of train and test. panphon 0.22.2 counts each as two units. Those counts also count every space as one unit, 333, 38 and 76 of them. One guess is that an older panphon counted each as one unit. Not verified. +* Table 4 on page 3661 lists 10 vowel pairs. All 10 are in the data, as two vowel letters in a row in one word. The data also has `ui`, 43 times, and `ɨə` and `ae`, 3 times each. ## Symbols the evaluation drops @@ -186,19 +187,19 @@ Each of these is left in, so that nobody's research labels change quietly. | `tone_dias` | 23,341 | 6,405 | 27.44% | 2,241 | 0.2738 | | `tone_letters` | 29,733 | 12,835 | 43.17% | 2,241 | 0.4275 | -* The loss in `no_tones` is the 10 accented vowels listed above, under finding F7. +* The loss in `no_tones` is the 10 accented vowels listed under Cleaning still needed. `preprocess_ipa` drops a precomposed vowel whole. * Every tone mark is lost in the two tone forms. So FER cannot see tone today, and PER punishes a model for every tone mark it does not write. * In `tone_letters`, `preprocess_ipa` also loses `U+0303`, which marks a nasal vowel, 38 times, and the syllable mark `U+0329` 3 times. In `tone_dias`, it loses `U+0303` 3 times. -* `simplify_ipa` leaves tone marks in 2,241 labels of `tone_dias` and 2,173 of `tone_letters`, as in finding F10. -* The cleaned labels have 1.166 code points per unit in `no_tones`, finding F12. +* `simplify_ipa` leaves tone marks in 2,241 labels of `tone_dias` and 2,173 of `tone_letters`, although its docstring says it removes tones. +* FER divides by the code points of the cleaned label, not by phones. The cleaned `no_tones` labels have 1.166 code points per panphon unit. ## Resampling -`audio_resample` has no low pass filter, finding F6, so sound above 8 kHz folds back at 16 kHz. In the 2,173 files at 22,050 Hz, the share of energy above 8 kHz has a median of 0.00053, about minus 33 dB, and a 95th percentile of 0.015. Its largest value is 0.227. +`audio_resample` has no low pass filter, so sound above 8 kHz folds back at 16 kHz. We measured the 2,173 files at 22,050 Hz. The share of their energy above 8 kHz has a median of 0.00053, about minus 33 dB. Its 95th percentile is 0.015, and its largest value is 0.227. ## What it is good for -* A test of whether a model hears the phones of a language it has never seen. The labels were written by people who knew phonetics. +* A test of whether a model hears the phones of a language it has never seen. A person trained in phonetics wrote the labels, and a second person checked them. * Tusom2021 is not listed in the training data of `KoelLabs/xlsr-english-01`, and its base model's card names Common Voice with no list of languages. We read those cards on Nov 7. The pages could not be reached on Nov 9, so this was not checked again. Whether Common Voice has this language is not verified. * A small tuning set. The paper's best PER after tuning is 33%, from a baseline of 72%, page 3663. Its zero shot results are on page 3662. @@ -214,7 +215,7 @@ Those rows are from Table 6, with the columns PER, Add, Del and Sub. They use `n ## What the data does not cover * Other speakers, men, other ages. -* Sentences or connected speech. +* Running speech. A few items are short sentences, and 75 labels have 3 or more words. * Any other recording setup. * Phone times. The paper says the words were aligned by hand in Praat, page 3662, and the release has no TextGrid file. From f4402e3bd0433004362be00873b902e46498affd Mon Sep 17 00:00:00 2001 From: RaunakGengiti2725 Date: Mon, 9 Nov 2026 12:42:00 +0000 Subject: [PATCH 7/9] Tusom2021: name the file in two more data errors A second review found two errors that named no file and gave no fix. A YAML file with bytes that are not UTF-8 raised a bare decode error, and a WAV that goes away after the dataset is built raised a plain open error. Both now give the file and the same fix text as the other errors. A comment that gave the wrong reason for using soundfile is corrected. Every item of every split and form is the same as in the previous commit. --- scripts/data_loaders/Tusom2021.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/data_loaders/Tusom2021.py b/scripts/data_loaders/Tusom2021.py index 07863dfc..5f624379 100644 --- a/scripts/data_loaders/Tusom2021.py +++ b/scripts/data_loaders/Tusom2021.py @@ -47,7 +47,7 @@ def read_labels(name): try: with open(path, encoding="utf-8") as f: entries = yaml.safe_load(f) - except yaml.YAMLError as e: + except (yaml.YAMLError, UnicodeDecodeError) as e: raise ValueError(f"Cannot parse {path}. {e}. {FIX}") from e if not isinstance(entries, dict): raise ValueError(f"{path} is not a YAML mapping. {FIX}") @@ -61,13 +61,15 @@ def read_labels(name): def read_wav(path): """A WAV file as int16 at 16 kHz.""" + if not os.path.exists(path): + raise FileNotFoundError(f"{path} not found. {FIX}") with open(path, "rb") as f: header = f.read(12) # soundfile would return a shorter clip from a file that was cut short, without any error. # The size field of the RIFF header gives it away. It holds the file size minus 8 bytes. if int.from_bytes(header[4:8], "little") + 8 != os.path.getsize(path): raise ValueError(f"The WAV file {path} is cut short or is not a WAV. {FIX}") - # soundfile reads the header, where core/audio.py assumes that samples start at byte 44. + # soundfile reports the channels and the sample format, so that they can be checked here. try: with soundfile.SoundFile(path) as f: if f.channels != 1 or f.subtype != "PCM_16" or f.frames == 0: From 2136f634e80c281d776ad4a6cf70343a5d08a7b7 Mon Sep 17 00:00:00 2001 From: RaunakGengiti2725 Date: Mon, 9 Nov 2026 12:52:36 +0000 Subject: [PATCH 8/9] Tusom2021: correct two lines of the notes A second review found two lines that said too much. The docstring of simplify_ipa does not mention tones. The function only calls a helper that removes them. And not all of the other token groups are real differences between tokens, since two are plainly different words. No code changes. --- docs/datasets/Tusom2021.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/datasets/Tusom2021.md b/docs/datasets/Tusom2021.md index 3405ccbc..ff91bc4f 100644 --- a/docs/datasets/Tusom2021.md +++ b/docs/datasets/Tusom2021.md @@ -40,8 +40,8 @@ Why the default is `none`. Both experiments in the paper use that form, on pages | Distinct panphon units | 59 with no tones, 61 with tone marks, 64 with tone letters | Loader | | WAV format | all 2,392 are mono, 16 bit PCM, plain 44 byte header | Data | | Sample rate | 2,173 files at 22,050 Hz, 219 at 16,000 Hz | Data | -| Load time, one pass over all 2,255 items | 3.6 s, 621 items per second, on the Linux VM from the Mac's shared folder | `Tusom2021Dataset` on Nov 9 | -| Setup time for all | 1.68 s, best of 3 | Same | +| Load time, one pass over all 2,255 items | 3.6 s, 625 items per second, on the Linux VM from the Mac's shared folder | `Tusom2021Dataset` on Nov 9 | +| Setup time for all | 1.70 s, best of 3 | Same | | Peak memory | 338 MB, the whole process with its imports | Same | Clip seconds per split. @@ -130,7 +130,7 @@ The first transcription of a word was made before the recording, page 3662. Late In some cases, tokens of a type are not phonetically identical (and are not identically transcribed). ``` -In the data, 721 groups of two or more tokens share a stem and a gloss. 34 of them have more than one `tone_dias` form. In 11 of the 34, each form has three or more tokens, so those look like different words with one gloss. The others look like real differences between tokens, or errors, such as `verb17-19.wav` below. +In the data, 721 groups of two or more tokens share a stem and a gloss. 34 of them have more than one `tone_dias` form. In 11 of the 34, each form has three or more tokens, so those look like different words with one gloss. Most of the others look like real differences between tokens, or errors, such as `verb17-19.wav` below. ## Transcription conventions @@ -190,7 +190,7 @@ Each of these is left in, so that nobody's research labels change quietly. * The loss in `no_tones` is the 10 accented vowels listed under Cleaning still needed. `preprocess_ipa` drops a precomposed vowel whole. * Every tone mark is lost in the two tone forms. So FER cannot see tone today, and PER punishes a model for every tone mark it does not write. * In `tone_letters`, `preprocess_ipa` also loses `U+0303`, which marks a nasal vowel, 38 times, and the syllable mark `U+0329` 3 times. In `tone_dias`, it loses `U+0303` 3 times. -* `simplify_ipa` leaves tone marks in 2,241 labels of `tone_dias` and 2,173 of `tone_letters`, although its docstring says it removes tones. +* `simplify_ipa` leaves tone marks in 2,241 labels of `tone_dias` and 2,173 of `tone_letters`, although it calls `remove_tones_and_stress`. * FER divides by the code points of the cleaned label, not by phones. The cleaned `no_tones` labels have 1.166 code points per panphon unit. ## Resampling From 83c0acb30604a97dc29b85ba977fefb4e7b28e11 Mon Sep 17 00:00:00 2001 From: Alexander Metzger Date: Thu, 19 Nov 2026 18:10:40 -0800 Subject: [PATCH 9/9] Simplify Tusom2021 loader and normalize IPA labels --- docs/datasets/Tusom2021.md | 232 ------------------------------ scripts/data_loaders/Tusom2021.py | 229 ++++++++++++----------------- 2 files changed, 91 insertions(+), 370 deletions(-) delete mode 100644 docs/datasets/Tusom2021.md diff --git a/docs/datasets/Tusom2021.md b/docs/datasets/Tusom2021.md deleted file mode 100644 index ff91bc4f..00000000 --- a/docs/datasets/Tusom2021.md +++ /dev/null @@ -1,232 +0,0 @@ -# Tusom2021 - -These notes are from Nov 9, 2026. Every number comes from the real data, the repo https://github.com/dmort27/tusom2021 at commit `e168dfb`, unless a line says otherwise. Facts from the paper give the page of the Interspeech 2021 PDF. Where the paper and the data disagree, both are given. What we could not check says not verified. - -## Words used below - -* A phone is one speech sound. -* A token is one spoken instance of a word or short phrase, in one WAV file. A type is one word or phrase. Most types here have three tokens. -* A label is the transcription of one token. `mapping.yml` gives each token three labels, one in each form. -* FER and PER are the two scores that the `evaluate` function in `scripts/eval/evaluate.py` returns. Both are error rates, so 0 is a perfect match. PER counts the character edits between the two raw strings. FER weighs the edits by sound features, after `preprocess_ipa` cleans both strings. -* A glottocode is a language id from Glottolog, a catalog of the world's languages. - -## Loader - -`scripts/data_loaders/Tusom2021.py`, class `Tusom2021Dataset`. - -* `split` is `train`, `dev`, `test` or `all`. The first three are the dataset's own files. -* `tones` is `none`, `diacritics` or `letters`, for the fields `no_tones`, `tone_dias` and `tone_letters`. The default is `none`. -* `include_timestamps=True` fails, since the data has no phone times. -* `include_speaker_info=True` gives a dict with `id`, `recording`, `speaker`, `language`, `source` and `raw_label`. `raw_label` is the exact field from `mapping.yml`. -* `include_text=True` gives the English gloss, since East Tusom has no writing system, page 3660. - -Why the default is `none`. Both experiments in the paper use that form, on pages 3662 and 3663. Tones also add nothing to FER today, since `preprocess_ipa` drops every tone mark. See Symbols the evaluation drops below. There is one cost. With this form, 10 labels are in two splits, as Splits below says. The default is one argument to change. - -## Report - -| Item | Value | Source | -|---|---|---| -| Language | East Tusom, a Tangkhulic language of Manipur, India | Paper, page 3660 | -| Language codes | no `ISO 639-3` code, glottocode `east2902` | Paper, page 3660, and the Glottolog entry for Mortensen and Picone 2021 | -| Speakers | 1 | Paper, page 3661 | -| WAV files on disk | 2,392 | Data | -| Labels in `mapping.yml` | 2,255 | Data | -| Items, train, dev, test | 1,578, 230, 447 | Data, equal to Table 5 of the paper | -| WAV files with no label, skipped | 137 | Data | -| Audio minutes, train, dev, test, all | 36.49, 5.20, 10.13, 51.83 | Data, equal to Table 5 to one decimal | -| Clip seconds, all items | shortest 0.223, median 1.303, 95th percentile 2.121, longest 4.772 | Loader | -| Clips over 30 s | 0 | Loader | -| Phone times | none in the data | Data | -| Distinct panphon units | 59 with no tones, 61 with tone marks, 64 with tone letters | Loader | -| WAV format | all 2,392 are mono, 16 bit PCM, plain 44 byte header | Data | -| Sample rate | 2,173 files at 22,050 Hz, 219 at 16,000 Hz | Data | -| Load time, one pass over all 2,255 items | 3.6 s, 625 items per second, on the Linux VM from the Mac's shared folder | `Tusom2021Dataset` on Nov 9 | -| Setup time for all | 1.70 s, best of 3 | Same | -| Peak memory | 338 MB, the whole process with its imports | Same | - -Clip seconds per split. - -| Split | Shortest | Median | 95th percentile | Longest | -|---|---|---|---|---| -| train | 0.223 | 1.302 | 2.148 | 4.772 | -| dev | 0.682 | 1.321 | 1.987 | 2.863 | -| test | 0.588 | 1.285 | 2.124 | 3.557 | - -## Speakers - -There is one speaker. The paper says this on page 3661. - -``` -The data were collected from one native female speaker of East Tusom in her late 20s. She did not grow up in Tusom village but spoke the language at home, with her family, and when she stayed with her extended family in Tusom. -``` - -The speaker has no code in the data. The loader gives every item the same `speaker` value. With one speaker, this data can say nothing about how a model handles different speakers. - -## Speech type and recording - -* Elicited words and short phrases from a comparative word list of about 2,400 items, page 3662. -* The first author gave an English word and the speaker answered in East Tusom, three times, page 3662. -* Recorded in 2004, page 3661, on an inexpensive lavalier microphone into the analog jack of a laptop running Audacity, page 3662. -* The paper describes the noise on page 3660. These are its words. - -``` -The recording equipment was optimized for price and portability, rather than acoustic fidelity and there is considerable background noise (from air conditioning and small children). -``` - -* The WAV names have 42 stems with labeled items, such as `animals1` or `verb14`. The paper says each tranche of words was recorded in one session, page 3662. That the stems are those sessions is likely, not verified. The loader returns the stem as `recording`. -* Loudness differs much between stems. In 12 of the 42, the median clip is under minus 40 dB, and they hold 665 of the 2,255 items. They are `bp1` to `bp10`, `numbers` and `numbers2`. The median of their medians is minus 44.2 dB, and of the other stems minus 30.5 dB. -* No clip is all zeros. In 38 clips, the loudest 20 ms frame is under minus 40 dB. This check can find silence and clipping. It cannot show that a clip holds the word in its label. - -## License and how to get the data - -The data repo has an MIT License, copyright 2021 David R. Mortensen, in its `LICENSE` file. Nobody has to sign anything to download it. The commands are in the header of the loader. - -The MIT License is written for software. Neither the paper nor the repo says whether it is meant to cover the recordings, or what the speaker agreed to. We make no legal judgment on that. - -## Citation - -The project page at https://llab-cmu.github.io/projects/tusom-project.html asks users to cite the Interspeech version, not the arXiv one. - -``` -David R. Mortensen, Jordan Picone, Xinjian Li, and Kathleen Siminyu. Tusom2021: A Phonetically Transcribed Speech Dataset from an Endangered Language for Universal Phone Recognition Experiments. In Proc. Interspeech 2021, pages 3660-3664. doi:10.21437/Interspeech.2021-1435 -``` - -## How the labels were made - -### In short - -People wrote these labels. The paper names no G2P step and no forced alignment, and East Tusom has no writing system to convert from, page 3660. One person with graduate training in phonetics and field linguistics wrote them first, over several passes. A second person checked all of them. The paper gives no measure of agreement. These are the paper's words, from page 3662. - -``` -The first author, who had graduate training in phonetics and field linguistics, elicited an item from the speaker, then attempted to imitate it until the speaker confirmed that it was correctly produced, then transcribed it. -``` - -``` -The transcriptions and the recordings were subsequently aligned manually, using Praat TextGrids [9]. The first author then made a pass over the transcriptions. Subsequently, the first author made a partial second pass, correcting transcriptions of tone. The second author made a global pass, checking all transcriptions for correctness and consistency. Final consistency checks were done using a combination of automatic and manual methods (using Python scripts to extract all tokens transcribed with a particular phone, then using auditory inspection and acoustic analysis—using Praat—to winnow out distinctions that had been inconsistently noted in the previous pass, such as voicing in plosives). -``` - -``` -We estimate that the production of the transcriptions alone, leaving aside elicitation, recording, and segmentation, took over 200 hours. -``` - -### Human or machine - -Human, as far as the paper says. The only machine part it names is a set of scripts, on page 3662. They pulled out every token with a given phone, so that a person could check those tokens by ear and in Praat. - -### Training of the people involved - -* The first author had graduate training in phonetics and field linguistics, page 3662. -* The second author is listed under the Department of Linguistics, University of Pittsburgh, page 3660. The paper does not state this person's training. - -### Number of annotators and agreement - -The paper names two people. One wrote and corrected the labels. The other checked all of them. It does not say who did the final checks. It reports no agreement figure. So this dataset cannot measure agreement between annotators, which issue #10 of this repo asks about. - -### Words first written at elicitation - -The first transcription of a word was made before the recording, page 3662. Later passes corrected it. The paper does not say how many labels each pass changed. Tokens of one type can differ, as the paper says on page 3662. - -``` -In some cases, tokens of a type are not phonetically identical (and are not identically transcribed). -``` - -In the data, 721 groups of two or more tokens share a stem and a gloss. 34 of them have more than one `tone_dias` form. In 11 of the 34, each form has three or more tokens, so those look like different words with one gloss. Most of the others look like real differences between tokens, or errors, such as `verb17-19.wav` below. - -## Transcription conventions - -* Phones, not phonemes, page 3660. The paper does not use the words broad or narrow. -* IPA, as Unicode text. The joined sounds `t͡s` and `t͡ɕ` have a tie bar, 335 in all. Aspiration is the letter `ʰ`, and a nasal vowel is a vowel with `U+0303` after it. -* Two vowels in a row have no mark between them. -* Tones, three in all, high, low and falling, page 3660. `tone_dias` writes them as the combining marks `U+0301`, `U+0300` and `U+0302`. `tone_letters` writes them as Chao letters after each syllable, such as `˥˧`. -* No stress marks and no length marks. -* 340 labels have a space between words. - -## Cleaning done by the authors - -The final checks on page 3662 removed distinctions that had been marked unevenly, such as voicing in plosives. See the quote above. The paper also says that an uncorrected subset of this data was used in an earlier paper, page 3661. - -## Cleaning done in this loader - -* 137 WAV files have no label, so they are skipped and counted, in `self.skipped`. -* White space comes out of the IPA. This changes 343 labels, and the count of each split is in `self.cleaned`. 340 have spaces between words. 6 have the control character `U+001D`, and 3 of those also have a space. The repo's training code and `preprocess_ipa` also remove spaces, and PER would count them. The exact label is still in `raw_label`. -* No Unicode normalization. It would turn `a` followed by `U+0303` into the single letter `ã`, which `preprocess_ipa` drops whole. -* No phone is changed. No audio is trimmed or made louder. Audio is read with `soundfile` and made 16 kHz with the repo's `audio_resample`. - -## Cleaning still needed - -Each of these is left in, so that nobody's research labels change quietly. - -* `verb17-19.wav` has the label `ɑ` in all three forms. The tokens next to it, with the same gloss, high, have `kət͡ɕʰuə`. It looks like a typing error. It is in train. -* `bp9-85.wav` is 0.223 s long and almost silent, with a peak of 0.0064 of full scale, for a label of 7 sounds. It is in train. -* 7 labels of `no_tones` still have tone on a vowel, 10 accented vowels in all. They are `bp12-6` to `bp12-9`, with `á`, and `bp2-70` to `bp2-72`, with `á` and `ỳ`. `preprocess_ipa` drops these vowels whole. They also put two bare tone marks, `U+0300` and `U+0301`, in `vocab` for the form with no tones. -* `g` is the plain letter in the 3 labels `animals1-22` to `animals1-24`, instead of the IPA letter `U+0261`. `preprocess_ipa` accepts it. -* `ʃ` appears in the 3 labels `verb13-38` to `verb13-40`, where the rest of the data has `ɕ`. `ɨ` appears 16 times next to the common `ɯ`. Whether these are real differences is not verified. -* `bp10-84.wav`, which has a label, is byte for byte the same file as `bp10-74.wav`, which has none. No two labeled items share audio. -* The 137 unlabeled files could be labeled, but only by listening. Why they were left out is not stated. All 137 are in `data/wav/transcriptions.tsv`, which looks like an earlier draft, with 774 rows. It writes `ʃ` and `ɨ` where `mapping.yml` writes `ɕ` and `ɯ`. `mapping.yml` has 637 of its rows. With those letters and a few marks folded together, 318 rows are equal and 124 are a different word. For 116 of those 124, the same word is in `mapping.yml` within 10 file numbers, in 8 stems. So the draft's rows are shifted in those stems, and it cannot be trusted file by file. 66 of the 137 have a number one more than a multiple of 4, which would fit the first of four tokens. Their pitch, by a rough estimate, is like that of the labeled clips. Its median is near 210 Hz. So they are probably the same speaker. The loader does not read this file. - -## Splits - -* `partition_data.py`, run on a copy with the pinned Python and packages, rebuilds `train.yml`, `dev.yml` and `test.yml` byte for byte. It groups tokens by their `tone_dias` label and shuffles the groups with seed 256. The first 70% of the groups are train, the next 10% dev, and the rest test. -* So no `tone_dias` label is in two splits. 10 `no_tones` labels are, since words that differ only in tone can land in different splits. They are `kəka`, `kətxuə`, `kətʰuə`, `kəxui`, `kʰəmɯə`, `kʰənt͡sɯ`, `kʰəŋuə`, `t͡ɕuŋkʰəma`, `ʔikətuəpi` and `ʔɯkʰr̥u`. With `tones="none"`, a few test labels also occur in train. -* The split is by label, not by speaker or session. 37 stems are in both train and test. For a model that never saw this language, this does not matter. For fine tuning it does. - -## Where the paper and the data differ - -* The paper's Section 3 says 2,393 tokens on page 3662. The abstract and Table 5 say 2,255, which is the number of labels. The disk has 2,392 WAV files. `data/wav` has 2,393 files if `transcriptions.tsv` is counted, which may be where that number comes from. Not verified. -* The paper says the recordings are at 22.05 kHz, page 3662. 219 files are at 16 kHz, all of the stems `bp4`, `bp5` and `bp6`. -* Table 5 gives 15,132, 2,133 and 4,283 phones. `partition_data.py` prints 15,136, 2,133 and 4,289 today. The differences, 4 and 6, are exactly the precomposed vowels `á` and `ỳ` in the `tone_dias` labels of train and test. panphon 0.22.2 counts each as two units. Those counts also count every space as one unit, 333, 38 and 76 of them. One guess is that an older panphon counted each as one unit. Not verified. -* Table 4 on page 3661 lists 10 vowel pairs. All 10 are in the data, as two vowel letters in a row in one word. The data also has `ui`, 43 times, and `ɨə` and `ae`, 3 times each. - -## Symbols the evaluation drops - -`evaluate(ipa, ipa)` gives PER 0 and FER 0 on every item of every form, and it never raises. - -| Form | Code points | Lost in `preprocess_ipa` | Share | Labels affected | PER of a perfect prediction with no tones | -|---|---|---|---|---|---| -| `no_tones` | 16,949 | 10 | 0.06% | 7 | 0 | -| `tone_dias` | 23,341 | 6,405 | 27.44% | 2,241 | 0.2738 | -| `tone_letters` | 29,733 | 12,835 | 43.17% | 2,241 | 0.4275 | - -* The loss in `no_tones` is the 10 accented vowels listed under Cleaning still needed. `preprocess_ipa` drops a precomposed vowel whole. -* Every tone mark is lost in the two tone forms. So FER cannot see tone today, and PER punishes a model for every tone mark it does not write. -* In `tone_letters`, `preprocess_ipa` also loses `U+0303`, which marks a nasal vowel, 38 times, and the syllable mark `U+0329` 3 times. In `tone_dias`, it loses `U+0303` 3 times. -* `simplify_ipa` leaves tone marks in 2,241 labels of `tone_dias` and 2,173 of `tone_letters`, although it calls `remove_tones_and_stress`. -* FER divides by the code points of the cleaned label, not by phones. The cleaned `no_tones` labels have 1.166 code points per panphon unit. - -## Resampling - -`audio_resample` has no low pass filter, so sound above 8 kHz folds back at 16 kHz. We measured the 2,173 files at 22,050 Hz. The share of their energy above 8 kHz has a median of 0.00053, about minus 33 dB. Its 95th percentile is 0.015, and its largest value is 0.227. - -## What it is good for - -* A test of whether a model hears the phones of a language it has never seen. A person trained in phonetics wrote the labels, and a second person checked them. -* Tusom2021 is not listed in the training data of `KoelLabs/xlsr-english-01`, and its base model's card names Common Voice with no list of languages. We read those cards on Nov 7. The pages could not be reached on Nov 9, so this was not checked again. Whether Common Voice has this language is not verified. -* A small tuning set. The paper's best PER after tuning is 33%, from a baseline of 72%, page 3663. Its zero shot results are on page 3662. - -``` -test eng 88.4% 9.6% 14.6% 64.2% - lg_ind 71.9% 2.5% 24.0% 45.4% -all eng 88.9% 9.8% 14.7% 64.3% - lg_ind 69.2% 3.2% 23.7% 42.4% -``` - -Those rows are from Table 6, with the columns PER, Add, Del and Sub. They use `no_tones` with rare phones replaced by similar common ones, page 3662, so they are not scores on these raw labels. - -## What the data does not cover - -* Other speakers, men, other ages. -* Running speech. A few items are short sentences, and 75 labels have 3 or more words. -* Any other recording setup. -* Phone times. The paper says the words were aligned by hand in Praat, page 3662, and the release has no TextGrid file. - -## How we checked - -Scripts are kept outside this PR. They read every label and every WAV file. The loader's own tests ran on every item of every split and form, and compared each item with `mapping.yml` and with its WAV file. Results are the same under two hash seeds and between commits. Nobody has listened to the clips against their labels yet, so we do not claim that the audio matches the labels. - -## Sources - -* The data repo, https://github.com/dmort27/tusom2021, commit `e168dfb90f2b03d433742d5ba5ef5e5731686610`, read Nov 9, 2026. -* The paper as a PDF, https://www.isca-archive.org/interspeech_2021/mortensen21_interspeech.pdf, read Nov 9, 2026. -* Glottolog, https://glottolog.org/resource/reference/id/636054, read Nov 9, 2026. -* The project page, https://llab-cmu.github.io/projects/tusom-project.html, read Nov 4, 2026. -* The model cards, https://huggingface.co/KoelLabs/xlsr-english-01 and https://huggingface.co/facebook/wav2vec2-xlsr-53-espeak-cv-ft, read through a web reader on Nov 7, 2026. diff --git a/scripts/data_loaders/Tusom2021.py b/scripts/data_loaders/Tusom2021.py index 5f624379..e4a3ad07 100644 --- a/scripts/data_loaders/Tusom2021.py +++ b/scripts/data_loaders/Tusom2021.py @@ -1,191 +1,144 @@ -# Tusom2021, a phonetically transcribed word list from East Tusom, an endangered Tibeto-Burman -# language of Northeast India. One speaker, 2,255 utterances, 51.8 minutes. -# Data: https://github.com/dmort27/tusom2021 -# Paper: https://www.isca-archive.org/interspeech_2021/mortensen21_interspeech.html -# License: the MIT License, in the LICENSE file of the data repo. +# Tusom2021 contains 2,255 labeled clips (51.8 min) of elicited words and short +# phrases from one native speaker of East Tusom, a Tangkhulic variety of Manipur, India. +# The 2004 recordings used a lavalier microphone and contain background noise. +# One linguist transcribed the words and a second reviewed the labels. The +# authors aligned the clips manually in Praat. The paper reports no agreement score. +# The released labels are clip-level IPA with optional tone marks. +# Paper and citation: https://www.isca-archive.org/interspeech_2021/mortensen21_interspeech.html # -# Download instructions: -# git clone https://github.com/dmort27/tusom2021 ./.data/Tusom2021 -# git -C ./.data/Tusom2021 checkout e168dfb90f2b03d433742d5ba5ef5e5731686610 +# The upstream dataset and its audio mirror are MIT-licensed. +# https://github.com/dmort27/tusom2021/blob/e168dfb90f2b03d433742d5ba5ef5e5731686610/LICENSE +# https://huggingface.co/datasets/changelinglab/tusom2021-pr # -# Tested on Nov 9, 2026, on the real files at that commit. Every item of train, dev, test and all -# was checked in each of the three label forms. No person has listened to the clips yet. -# TODO: manual verification +# Download the original split files and WAVs: +# git clone https://github.com/dmort27/tusom2021 .data/Tusom2021 +# git -C .data/Tusom2021 checkout e168dfb90f2b03d433742d5ba5ef5e5731686610 import os import sys +from pathlib import Path +from unicodedata import normalize +import numpy as np import panphon -import soundfile import yaml sys.path.append(os.path.join(os.path.dirname(__file__), "..")) +from core.audio import audio_file_to_array from data_loaders.common import BaseDataset, interactive_flag_samples -from core.audio import audio_resample, TARGET_SAMPLE_RATE - -DATA_REPO = "https://github.com/dmort27/tusom2021" -DATA_DIR = os.path.join( - os.path.dirname(__file__), "..", "..", ".data", "Tusom2021", "data" -) -WAV_DIR = os.path.join(DATA_DIR, "wav") -# Added to every error about the data files, so that the error says what fixes it. -FIX = ( - f"From the repo root, get the data with git clone {DATA_REPO} ./.data/Tusom2021" - " and git -C ./.data/Tusom2021 checkout e168dfb90f2b03d433742d5ba5ef5e5731686610," - " or repair a damaged copy with git -C ./.data/Tusom2021 checkout -- data" -) + +SOURCE = "https://github.com/dmort27/tusom2021" +DATA_DIR = Path(__file__).resolve().parents[2] / ".data" / "Tusom2021" / "data" SPLITS = ("train", "dev", "test", "all") -# The value of `tones` and the field of mapping.yml that it picks. TONE_FIELDS = {"none": "no_tones", "diacritics": "tone_dias", "letters": "tone_letters"} +TONE_DIACRITICS = str.maketrans("", "", "\u0300\u0301\u0302") -def read_labels(name): - """The entries of one of the dataset's YAML files, by WAV file name.""" - path = os.path.join(DATA_DIR, name) - if not os.path.exists(path): - raise FileNotFoundError(f"{path} not found. {FIX}") - try: - with open(path, encoding="utf-8") as f: - entries = yaml.safe_load(f) - except (yaml.YAMLError, UnicodeDecodeError) as e: - raise ValueError(f"Cannot parse {path}. {e}. {FIX}") from e - if not isinstance(entries, dict): - raise ValueError(f"{path} is not a YAML mapping. {FIX}") - for wav, entry in entries.items(): - for field in ("gloss", *TONE_FIELDS.values()): - text = entry.get(field) if isinstance(entry, dict) else None - if not isinstance(text, str) or not text.strip(): - raise ValueError(f"Entry {wav} of {path} has no text in {field}. {FIX}") - return entries - - -def read_wav(path): - """A WAV file as int16 at 16 kHz.""" - if not os.path.exists(path): - raise FileNotFoundError(f"{path} not found. {FIX}") - with open(path, "rb") as f: - header = f.read(12) - # soundfile would return a shorter clip from a file that was cut short, without any error. - # The size field of the RIFF header gives it away. It holds the file size minus 8 bytes. - if int.from_bytes(header[4:8], "little") + 8 != os.path.getsize(path): - raise ValueError(f"The WAV file {path} is cut short or is not a WAV. {FIX}") - # soundfile reports the channels and the sample format, so that they can be checked here. +def read_mapping(path): try: - with soundfile.SoundFile(path) as f: - if f.channels != 1 or f.subtype != "PCM_16" or f.frames == 0: - raise ValueError( - f"The WAV file {path} is not mono 16 bit audio with samples. {FIX}" - ) - audio, rate = f.read(dtype="int16"), f.samplerate - except soundfile.SoundFileError as e: - raise ValueError(f"Cannot decode the WAV file {path}. {e}. {FIX}") from e - return audio_resample(audio, rate, TARGET_SAMPLE_RATE) + with path.open(encoding="utf-8") as file: + mapping = yaml.safe_load(file) + except FileNotFoundError as error: + raise FileNotFoundError( + f"Missing {path}. Download Tusom2021 from {SOURCE}" + ) from error + if not isinstance(mapping, dict): + raise ValueError(f"Expected a YAML mapping in {path}") + return mapping class Tusom2021Dataset(BaseDataset): - """ - Valid splits are "train", "dev" and "test", from the dataset's own files, or "all". - - The text is the English gloss, since East Tusom has no writing system. + """Load an upstream split or all labeled clips. - `tones` picks the form of the label. "none" has no tones, "diacritics" writes them as - combining marks and "letters" as Chao tone letters. The default is "none" because the - paper's experiments use that form and evaluate.py drops every tone mark before FER. + The default uses the train split and tone-free IPA. The upstream splits + group tokens by tone-marked label, so tone-free labels can overlap. + Optional text is the English gloss. The release has no phone timings. """ def __init__( self, - split="all", + split="train", include_timestamps=False, include_speaker_info=False, include_text=False, tones="none", + *, + data_dir=DATA_DIR, ): super().__init__(split, include_timestamps, include_speaker_info, include_text) - - if include_timestamps: - # The paper aligned the words by hand in Praat, but the data has no TextGrid file. - raise ValueError("Tusom2021 has no phone timestamps") if split not in SPLITS: - raise ValueError(f"Unknown split {split}. Valid splits are {SPLITS}") + raise ValueError(f"Unknown Tusom2021 split {split!r}. Expected {SPLITS}") if tones not in TONE_FIELDS: raise ValueError( - f"Unknown tones {tones}. Valid forms are {list(TONE_FIELDS)}" - ) - self.tones = tones - self.label_field = TONE_FIELDS[tones] - - labels = read_labels("mapping.yml") - names = labels if split == "all" else read_labels(f"{split}.yml") - for name in names: - if name not in labels: - raise ValueError( - f"{name} is in {split}.yml but has no label in mapping.yml. {FIX}" - ) - self.files = sorted(names) - self.labels = {name: labels[name] for name in self.files} - - found = os.listdir(WAV_DIR) if os.path.isdir(WAV_DIR) else [] - wavs = set(n for n in found if n.endswith(".wav")) - missing = [name for name in self.files if name not in wavs] - if missing: - raise FileNotFoundError( - f"{len(missing)} of the {len(self.files)} WAV files of split {split} are not in" - f" {WAV_DIR}, such as {missing[0]}. {FIX}" + f"Unknown Tusom2021 tone form {tones!r}. Expected {tuple(TONE_FIELDS)}" ) - # The folder also holds WAV files that mapping.yml does not label. They are not used. - self.skipped = {"wav_without_label": sum(n not in labels for n in wavs)} - - # Counted because the IPA differs from the label in mapping.yml for these items. - self.cleaned = { - "label_with_white_space": sum( - self._ipa(name) != self._raw_label(name) for name in self.files - ) - } + if include_timestamps: + raise ValueError("Tusom2021 has no phone timestamps") - feature_table = panphon.FeatureTable() + data_dir = Path(data_dir) + labels = read_mapping(data_dir / "mapping.yml") + names = labels if split == "all" else read_mapping(data_dir / f"{split}.yml") + field = TONE_FIELDS[tones] + self.items = [] + for name in sorted(names): + label = labels.get(name) + if not isinstance(label, dict): + raise ValueError(f"Missing Tusom2021 label for {name} in mapping.yml") + raw, gloss = label.get(field), label.get("gloss") + if ( + not isinstance(raw, str) + or not isinstance(gloss, str) + or not gloss.strip() + ): + raise ValueError(f"Missing {field} label or English gloss for {name}") + path = data_dir / "wav" / name + if path.name != name or path.suffix != ".wav": + raise ValueError(f"Invalid Tusom2021 WAV name {name!r}") + if not path.is_file(): + raise FileNotFoundError(f"Missing Tusom2021 WAV {path}") + + ipa = "".join(normalize("NFD", raw).split()).replace("g", "ɡ") + if tones == "none": + # Some source no_tones labels have precomposed accented vowels. + ipa = ipa.translate(TONE_DIACRITICS) + if not ipa: + raise ValueError(f"Empty Tusom2021 IPA label for {name}") + self.items.append((path, ipa, raw, gloss)) + + features = panphon.FeatureTable() self.vocab = { - phone - for name in self.files - for phone in feature_table.segs_safe(self._ipa(name)) + phone for _, ipa, _, _ in self.items for phone in features.segs_safe(ipa) } - print( - f"Tusom2021 {split}, tones {tones}: {len(self.files)} items," - f" white space removed from {self.cleaned['label_with_white_space']} labels," - f" {self.skipped['wav_without_label']} WAV files with no label skipped" - ) - - def _raw_label(self, name): - return self.labels[name][self.label_field] - - def _ipa(self, name): - # White space separates words in some labels and is no phone. VoxAngeles removes it the - # same way. str.split also takes out the control character U+001D that is in 6 labels. - return "".join(self._raw_label(name).split()) def __len__(self): - return len(self.files) + return len(self.items) def _get_ix(self, ix): - name = self.files[ix] - outputs = [self._ipa(name), read_wav(os.path.join(WAV_DIR, name))] + path, ipa, raw, gloss = self.items[ix] + audio = audio_file_to_array(path) + if audio.ndim != 1 or audio.dtype != np.int16 or not audio.size: + raise ValueError(f"Expected mono 16-bit PCM samples in {path}") + result = [ipa, audio] if self.include_speaker_info: - outputs.append( + result.append( { - "id": name.removesuffix(".wav"), - "recording": name.rsplit("-", 1)[0], + "id": path.stem, + "recording": path.stem.rsplit("-", 1)[0], "speaker": "single female native speaker", "language": "East Tusom", - "source": DATA_REPO, - "raw_label": self._raw_label(name), + "source": SOURCE, + "license": "MIT", + "raw_label": raw, } ) if self.include_text: - outputs.append(self.labels[name]["gloss"]) - return tuple(outputs) + result.append(gloss) + return tuple(result) if __name__ == "__main__": - dataset = Tusom2021Dataset(include_speaker_info=True, include_text=True) + dataset = Tusom2021Dataset( + split="all", include_speaker_info=True, include_text=True + ) print(len(dataset)) interactive_flag_samples(dataset)