tujia-nlp 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tujia_nlp-0.2.0/LICENSE +21 -0
- tujia_nlp-0.2.0/MANIFEST.in +6 -0
- tujia_nlp-0.2.0/PKG-INFO +195 -0
- tujia_nlp-0.2.0/README.md +174 -0
- tujia_nlp-0.2.0/README.zh-CN.md +137 -0
- tujia_nlp-0.2.0/pyproject.toml +40 -0
- tujia_nlp-0.2.0/requirements.txt +6 -0
- tujia_nlp-0.2.0/schema/entry.schema.json +60 -0
- tujia_nlp-0.2.0/schema/manifest.schema.json +96 -0
- tujia_nlp-0.2.0/setup.cfg +4 -0
- tujia_nlp-0.2.0/src/tujia_nlp/__init__.py +55 -0
- tujia_nlp-0.2.0/src/tujia_nlp/data/north.json +1184 -0
- tujia_nlp-0.2.0/src/tujia_nlp/phone_norm.py +167 -0
- tujia_nlp-0.2.0/src/tujia_nlp/syllable.py +97 -0
- tujia_nlp-0.2.0/src/tujia_nlp/tones.py +72 -0
- tujia_nlp-0.2.0/src/tujia_nlp/ye.py +191 -0
- tujia_nlp-0.2.0/src/tujia_nlp/zh_sound.py +189 -0
- tujia_nlp-0.2.0/src/tujia_nlp.egg-info/PKG-INFO +195 -0
- tujia_nlp-0.2.0/src/tujia_nlp.egg-info/SOURCES.txt +25 -0
- tujia_nlp-0.2.0/src/tujia_nlp.egg-info/dependency_links.txt +1 -0
- tujia_nlp-0.2.0/src/tujia_nlp.egg-info/requires.txt +6 -0
- tujia_nlp-0.2.0/src/tujia_nlp.egg-info/top_level.txt +1 -0
- tujia_nlp-0.2.0/tests/test_phone_norm.py +52 -0
- tujia_nlp-0.2.0/tests/test_syllable.py +49 -0
- tujia_nlp-0.2.0/tests/test_tones.py +33 -0
- tujia_nlp-0.2.0/tests/test_ye.py +106 -0
- tujia_nlp-0.2.0/tests/test_zh_sound.py +65 -0
tujia_nlp-0.2.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 BaiBing
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
tujia_nlp-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tujia-nlp
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Tujia orthography utilities: tone notation, IPA to Ye conversion, phone normalisation
|
|
5
|
+
Author: TujiaNLP contributors
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/ibaibing/TujiaNLP
|
|
8
|
+
Keywords: tujia,tji,orthography,ipa,ye,low-resource
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Natural Language :: Chinese (Simplified)
|
|
12
|
+
Classifier: Topic :: Text Processing :: Linguistic
|
|
13
|
+
Requires-Python: >=3.9
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Provides-Extra: test
|
|
17
|
+
Requires-Dist: pytest>=7; extra == "test"
|
|
18
|
+
Provides-Extra: zh
|
|
19
|
+
Requires-Dist: pypinyin>=0.50; extra == "zh"
|
|
20
|
+
Dynamic: license-file
|
|
21
|
+
|
|
22
|
+
# TujiaNLP
|
|
23
|
+
|
|
24
|
+
Preserving the endangered **Northern Tujia** language with AI.
|
|
25
|
+
|
|
26
|
+
> Tujia is now spoken mainly by elderly native speakers. This open-source project aims to
|
|
27
|
+
> digitise the language record and build Tujia speech, translation and dialogue models.
|
|
28
|
+
|
|
29
|
+
[Chinese version](README.zh-CN.md)
|
|
30
|
+
|
|
31
|
+
## Goals
|
|
32
|
+
|
|
33
|
+
1. Collect field recordings and build a consistently annotated bilingual corpus.
|
|
34
|
+
2. Train Tujia ASR (speech recognition) and TTS (speech synthesis).
|
|
35
|
+
3. Build Tujia ↔ Chinese machine translation.
|
|
36
|
+
4. Assemble a Tujia dialogue pipeline, modular first, LLM fine-tuning later.
|
|
37
|
+
5. Ship lightweight learning tools for language revitalisation.
|
|
38
|
+
|
|
39
|
+
## Scope
|
|
40
|
+
|
|
41
|
+
**Northern Tujia only** (Longshan / Yongshun / Laifeng area, Miaotan standard).
|
|
42
|
+
Southern Tujia is deliberately excluded for now, to avoid mixing dialects in training.
|
|
43
|
+
|
|
44
|
+
## Orthography
|
|
45
|
+
|
|
46
|
+
The project follows the **Yedshu–Peng (1984) Tujia romanisation** ("Ye"). Other
|
|
47
|
+
transcriptions are not used as the working standard.
|
|
48
|
+
|
|
49
|
+
Two IPA spellings appear in source materials for the same sounds:
|
|
50
|
+
|
|
51
|
+
| Earlier spelling | Current standard |
|
|
52
|
+
| --- | --- |
|
|
53
|
+
| `aŋ eŋ iŋ oŋ`, `ʐ`, `iu` | `ã ẽ ĩ ũ`, `z`, `iou` |
|
|
54
|
+
|
|
55
|
+
The `tujia_nlp` package normalises between them: input accepts either spelling, output is
|
|
56
|
+
always the current convention.
|
|
57
|
+
|
|
58
|
+
## Ecosystem
|
|
59
|
+
|
|
60
|
+
| Repository | Role |
|
|
61
|
+
| --- | --- |
|
|
62
|
+
| **TujiaNLP** (this) | Corpus terms, collection standards, orthography, licensing |
|
|
63
|
+
| [tujia-asr](https://github.com/ibaibing/tujia-asr) | Acoustic model releases: syllable-level CTC |
|
|
64
|
+
| [tujia-tts](https://github.com/ibaibing/tujia-tts) | Speech synthesis releases |
|
|
65
|
+
| [tujia-llm](https://github.com/ibaibing/tujia-llm) | LoRA adapters and the evaluation protocol |
|
|
66
|
+
|
|
67
|
+
Where the work happens:
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
audio ──► tujia-asr acoustic model, syllable-level output
|
|
71
|
+
|
|
72
|
+
text ──► tujia_nlp IPA ↔ Ye, tone notation ──► tts / llm data, annotations
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Rules of thumb:
|
|
76
|
+
|
|
77
|
+
- **This repository** owns language resources and contracts: the syllable table, the
|
|
78
|
+
orthography rules, the corpus terms, and the dictionary entry/manifest schemas.
|
|
79
|
+
- **tujia-asr / tujia-tts / tujia-llm** own model releases. Training code lives in private
|
|
80
|
+
`*-lib` / `*-lab` repositories.
|
|
81
|
+
|
|
82
|
+
## Installation
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
pip install tujia-nlp
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Requires Python 3.9+. No third-party dependencies.
|
|
89
|
+
|
|
90
|
+
## Usage
|
|
91
|
+
|
|
92
|
+
```python
|
|
93
|
+
from tujia_nlp import format_syllable, normalize_shape, to_ipa, to_ye
|
|
94
|
+
|
|
95
|
+
to_ye("la35") # "laf"
|
|
96
|
+
to_ye("kaŋ35") # "gangf" legacy input accepted
|
|
97
|
+
to_ipa("gangf") # "kã35" output in the current convention
|
|
98
|
+
format_syllable("la35", "ipa") # "la³⁵"
|
|
99
|
+
normalize_shape("ʐuo") # "zuo"
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Notation rules:
|
|
103
|
+
|
|
104
|
+
- `to_ipa` always emits the current convention: nasalised vowels `ã ẽ ĩ ũ`, `z`, `iou`.
|
|
105
|
+
- `to_ye` accepts both: legacy `aŋ eŋ iŋ oŋ`, `ʐ`, `iu` are folded before lookup.
|
|
106
|
+
- A few contrasts are not distinguished by the Ye scheme (`ɿ` / `i`, `ə` / `ɤ`), so conversion
|
|
107
|
+
is one-way: `to_ye` can produce Ye, `to_ipa` cannot recover them.
|
|
108
|
+
|
|
109
|
+
The syllable table covers 291 Northern Tujia syllables, 227 attested in corpus material and
|
|
110
|
+
64 derived by rule.
|
|
111
|
+
|
|
112
|
+
Beyond IPA ↔ Ye, three helpers are available as submodules:
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
from tujia_nlp import phone_norm, syllable, zh_sound
|
|
116
|
+
|
|
117
|
+
syllable.split_head("a⁵⁵ji²¹") # [("a", 55), ("ji", 21)]
|
|
118
|
+
syllable.tone_stats(["la³⁵"]) # tone usage per shape
|
|
119
|
+
phone_norm.canon("d") # ["t"] voiced stops fold onto voiceless
|
|
120
|
+
zh_sound.pinyin_to_ipa("ni3") # ("ni", 21)
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
`zh_sound.text_to_syllables` accepts hanzi only when the optional `pypinyin` package is
|
|
124
|
+
installed (`pip install "tujia-nlp[zh]"`); plain pinyin input needs nothing extra.
|
|
125
|
+
|
|
126
|
+
## Data coverage
|
|
127
|
+
|
|
128
|
+
The published package contains only the syllable table. Recordings, transcripts and
|
|
129
|
+
dictionary entries are not distributed.
|
|
130
|
+
|
|
131
|
+
## Repository layout
|
|
132
|
+
|
|
133
|
+
```
|
|
134
|
+
src/tujia_nlp/ the package: tones.py, ye.py, syllable.py, phone_norm.py, zh_sound.py
|
|
135
|
+
schema/ dictionary entry and pack manifest contracts (JSON Schema)
|
|
136
|
+
tests/ unit tests (pytest)
|
|
137
|
+
docs/ annotation standards and resources
|
|
138
|
+
dataset/ corpus metadata and fetch scripts (raw data is not committed)
|
|
139
|
+
tools/ early conversion scripts, superseded by the package
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Zenodo datasets
|
|
143
|
+
|
|
144
|
+
Two public North Tujia text corpora are archived on Zenodo. Only fetch scripts and checksums
|
|
145
|
+
live in this repository; the original files are not redistributed.
|
|
146
|
+
|
|
147
|
+
1. **V1 (DOI: 10.5281/zenodo.4446698)** — incomplete, contains annotation errors, for
|
|
148
|
+
provenance only, **not for training**.
|
|
149
|
+
2. **V2 (DOI: 10.5281/zenodo.4447924)** — the recommended source for translation, LLM, ASR
|
|
150
|
+
and TTS work; includes the orthography mapping, vocabulary, textbook sentences, folk
|
|
151
|
+
narratives and greetings.
|
|
152
|
+
|
|
153
|
+
The upstream record is marked `Other (Public Domain)`, which is not a standard licence. This
|
|
154
|
+
project does not redistribute the files. Standardised data derived by this project is
|
|
155
|
+
released under CC-BY 4.0, covering only the new conversion and annotation work.
|
|
156
|
+
|
|
157
|
+
### Citation
|
|
158
|
+
|
|
159
|
+
Zhou, Y., & Hill, N. W. (2021). *A collection of North Tujia (Bifzivsar) vocabulary and
|
|
160
|
+
textual passages for use in NLP* (Version 2) [Data set]. Zenodo.
|
|
161
|
+
https://doi.org/10.5281/zenodo.4447924
|
|
162
|
+
|
|
163
|
+
See `DATASET_LICENSE.md` for the full constraints.
|
|
164
|
+
|
|
165
|
+
## Contributing
|
|
166
|
+
|
|
167
|
+
- Tujia speakers: field recordings, semantic proofreading, pronunciation checks.
|
|
168
|
+
- NLP developers: model fine-tuning, code review, front-end tools.
|
|
169
|
+
- Linguists: vocabulary expansion and grammatical notes.
|
|
170
|
+
|
|
171
|
+
### Ethics
|
|
172
|
+
|
|
173
|
+
Every field recording requires prior **informed consent**. Speaker privacy must be protected
|
|
174
|
+
and recorded material must not be used commercially without permission.
|
|
175
|
+
|
|
176
|
+
## License
|
|
177
|
+
|
|
178
|
+
- Source code: **MIT** (see `LICENSE`).
|
|
179
|
+
- Third-party corpora: rights remain with the original authors; not licensed or redistributed here.
|
|
180
|
+
- Data produced by this project: **CC-BY 4.0**, excluding the original word lists.
|
|
181
|
+
- Field recordings: governed by each speaker's individual consent form.
|
|
182
|
+
|
|
183
|
+
## Roadmap
|
|
184
|
+
|
|
185
|
+
- [x] Repository bootstrapped
|
|
186
|
+
- [x] `tujia_nlp` orthography package (IPA ↔ Ye, tone notation)
|
|
187
|
+
- [x] Dictionary entry and pack manifest schemas
|
|
188
|
+
- [ ] Annotation standard finalised
|
|
189
|
+
- [ ] Base vocabulary assembled
|
|
190
|
+
- [ ] Field recording collection started
|
|
191
|
+
- [ ] Tujia ASR fine-tuning
|
|
192
|
+
- [ ] Tujia TTS training
|
|
193
|
+
- [ ] Tujia ↔ Chinese translation model
|
|
194
|
+
- [ ] Dialogue web demo
|
|
195
|
+
- [ ] LLM SFT (long-term)
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
# TujiaNLP
|
|
2
|
+
|
|
3
|
+
Preserving the endangered **Northern Tujia** language with AI.
|
|
4
|
+
|
|
5
|
+
> Tujia is now spoken mainly by elderly native speakers. This open-source project aims to
|
|
6
|
+
> digitise the language record and build Tujia speech, translation and dialogue models.
|
|
7
|
+
|
|
8
|
+
[Chinese version](README.zh-CN.md)
|
|
9
|
+
|
|
10
|
+
## Goals
|
|
11
|
+
|
|
12
|
+
1. Collect field recordings and build a consistently annotated bilingual corpus.
|
|
13
|
+
2. Train Tujia ASR (speech recognition) and TTS (speech synthesis).
|
|
14
|
+
3. Build Tujia ↔ Chinese machine translation.
|
|
15
|
+
4. Assemble a Tujia dialogue pipeline, modular first, LLM fine-tuning later.
|
|
16
|
+
5. Ship lightweight learning tools for language revitalisation.
|
|
17
|
+
|
|
18
|
+
## Scope
|
|
19
|
+
|
|
20
|
+
**Northern Tujia only** (Longshan / Yongshun / Laifeng area, Miaotan standard).
|
|
21
|
+
Southern Tujia is deliberately excluded for now, to avoid mixing dialects in training.
|
|
22
|
+
|
|
23
|
+
## Orthography
|
|
24
|
+
|
|
25
|
+
The project follows the **Yedshu–Peng (1984) Tujia romanisation** ("Ye"). Other
|
|
26
|
+
transcriptions are not used as the working standard.
|
|
27
|
+
|
|
28
|
+
Two IPA spellings appear in source materials for the same sounds:
|
|
29
|
+
|
|
30
|
+
| Earlier spelling | Current standard |
|
|
31
|
+
| --- | --- |
|
|
32
|
+
| `aŋ eŋ iŋ oŋ`, `ʐ`, `iu` | `ã ẽ ĩ ũ`, `z`, `iou` |
|
|
33
|
+
|
|
34
|
+
The `tujia_nlp` package normalises between them: input accepts either spelling, output is
|
|
35
|
+
always the current convention.
|
|
36
|
+
|
|
37
|
+
## Ecosystem
|
|
38
|
+
|
|
39
|
+
| Repository | Role |
|
|
40
|
+
| --- | --- |
|
|
41
|
+
| **TujiaNLP** (this) | Corpus terms, collection standards, orthography, licensing |
|
|
42
|
+
| [tujia-asr](https://github.com/ibaibing/tujia-asr) | Acoustic model releases: syllable-level CTC |
|
|
43
|
+
| [tujia-tts](https://github.com/ibaibing/tujia-tts) | Speech synthesis releases |
|
|
44
|
+
| [tujia-llm](https://github.com/ibaibing/tujia-llm) | LoRA adapters and the evaluation protocol |
|
|
45
|
+
|
|
46
|
+
Where the work happens:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
audio ──► tujia-asr acoustic model, syllable-level output
|
|
50
|
+
|
|
51
|
+
text ──► tujia_nlp IPA ↔ Ye, tone notation ──► tts / llm data, annotations
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Rules of thumb:
|
|
55
|
+
|
|
56
|
+
- **This repository** owns language resources and contracts: the syllable table, the
|
|
57
|
+
orthography rules, the corpus terms, and the dictionary entry/manifest schemas.
|
|
58
|
+
- **tujia-asr / tujia-tts / tujia-llm** own model releases. Training code lives in private
|
|
59
|
+
`*-lib` / `*-lab` repositories.
|
|
60
|
+
|
|
61
|
+
## Installation
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
pip install tujia-nlp
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Requires Python 3.9+. No third-party dependencies.
|
|
68
|
+
|
|
69
|
+
## Usage
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
from tujia_nlp import format_syllable, normalize_shape, to_ipa, to_ye
|
|
73
|
+
|
|
74
|
+
to_ye("la35") # "laf"
|
|
75
|
+
to_ye("kaŋ35") # "gangf" legacy input accepted
|
|
76
|
+
to_ipa("gangf") # "kã35" output in the current convention
|
|
77
|
+
format_syllable("la35", "ipa") # "la³⁵"
|
|
78
|
+
normalize_shape("ʐuo") # "zuo"
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Notation rules:
|
|
82
|
+
|
|
83
|
+
- `to_ipa` always emits the current convention: nasalised vowels `ã ẽ ĩ ũ`, `z`, `iou`.
|
|
84
|
+
- `to_ye` accepts both: legacy `aŋ eŋ iŋ oŋ`, `ʐ`, `iu` are folded before lookup.
|
|
85
|
+
- A few contrasts are not distinguished by the Ye scheme (`ɿ` / `i`, `ə` / `ɤ`), so conversion
|
|
86
|
+
is one-way: `to_ye` can produce Ye, `to_ipa` cannot recover them.
|
|
87
|
+
|
|
88
|
+
The syllable table covers 291 Northern Tujia syllables, 227 attested in corpus material and
|
|
89
|
+
64 derived by rule.
|
|
90
|
+
|
|
91
|
+
Beyond IPA ↔ Ye, three helpers are available as submodules:
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
from tujia_nlp import phone_norm, syllable, zh_sound
|
|
95
|
+
|
|
96
|
+
syllable.split_head("a⁵⁵ji²¹") # [("a", 55), ("ji", 21)]
|
|
97
|
+
syllable.tone_stats(["la³⁵"]) # tone usage per shape
|
|
98
|
+
phone_norm.canon("d") # ["t"] voiced stops fold onto voiceless
|
|
99
|
+
zh_sound.pinyin_to_ipa("ni3") # ("ni", 21)
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
`zh_sound.text_to_syllables` accepts hanzi only when the optional `pypinyin` package is
|
|
103
|
+
installed (`pip install "tujia-nlp[zh]"`); plain pinyin input needs nothing extra.
|
|
104
|
+
|
|
105
|
+
## Data coverage
|
|
106
|
+
|
|
107
|
+
The published package contains only the syllable table. Recordings, transcripts and
|
|
108
|
+
dictionary entries are not distributed.
|
|
109
|
+
|
|
110
|
+
## Repository layout
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
src/tujia_nlp/ the package: tones.py, ye.py, syllable.py, phone_norm.py, zh_sound.py
|
|
114
|
+
schema/ dictionary entry and pack manifest contracts (JSON Schema)
|
|
115
|
+
tests/ unit tests (pytest)
|
|
116
|
+
docs/ annotation standards and resources
|
|
117
|
+
dataset/ corpus metadata and fetch scripts (raw data is not committed)
|
|
118
|
+
tools/ early conversion scripts, superseded by the package
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Zenodo datasets
|
|
122
|
+
|
|
123
|
+
Two public North Tujia text corpora are archived on Zenodo. Only fetch scripts and checksums
|
|
124
|
+
live in this repository; the original files are not redistributed.
|
|
125
|
+
|
|
126
|
+
1. **V1 (DOI: 10.5281/zenodo.4446698)** — incomplete, contains annotation errors, for
|
|
127
|
+
provenance only, **not for training**.
|
|
128
|
+
2. **V2 (DOI: 10.5281/zenodo.4447924)** — the recommended source for translation, LLM, ASR
|
|
129
|
+
and TTS work; includes the orthography mapping, vocabulary, textbook sentences, folk
|
|
130
|
+
narratives and greetings.
|
|
131
|
+
|
|
132
|
+
The upstream record is marked `Other (Public Domain)`, which is not a standard licence. This
|
|
133
|
+
project does not redistribute the files. Standardised data derived by this project is
|
|
134
|
+
released under CC-BY 4.0, covering only the new conversion and annotation work.
|
|
135
|
+
|
|
136
|
+
### Citation
|
|
137
|
+
|
|
138
|
+
Zhou, Y., & Hill, N. W. (2021). *A collection of North Tujia (Bifzivsar) vocabulary and
|
|
139
|
+
textual passages for use in NLP* (Version 2) [Data set]. Zenodo.
|
|
140
|
+
https://doi.org/10.5281/zenodo.4447924
|
|
141
|
+
|
|
142
|
+
See `DATASET_LICENSE.md` for the full constraints.
|
|
143
|
+
|
|
144
|
+
## Contributing
|
|
145
|
+
|
|
146
|
+
- Tujia speakers: field recordings, semantic proofreading, pronunciation checks.
|
|
147
|
+
- NLP developers: model fine-tuning, code review, front-end tools.
|
|
148
|
+
- Linguists: vocabulary expansion and grammatical notes.
|
|
149
|
+
|
|
150
|
+
### Ethics
|
|
151
|
+
|
|
152
|
+
Every field recording requires prior **informed consent**. Speaker privacy must be protected
|
|
153
|
+
and recorded material must not be used commercially without permission.
|
|
154
|
+
|
|
155
|
+
## License
|
|
156
|
+
|
|
157
|
+
- Source code: **MIT** (see `LICENSE`).
|
|
158
|
+
- Third-party corpora: rights remain with the original authors; not licensed or redistributed here.
|
|
159
|
+
- Data produced by this project: **CC-BY 4.0**, excluding the original word lists.
|
|
160
|
+
- Field recordings: governed by each speaker's individual consent form.
|
|
161
|
+
|
|
162
|
+
## Roadmap
|
|
163
|
+
|
|
164
|
+
- [x] Repository bootstrapped
|
|
165
|
+
- [x] `tujia_nlp` orthography package (IPA ↔ Ye, tone notation)
|
|
166
|
+
- [x] Dictionary entry and pack manifest schemas
|
|
167
|
+
- [ ] Annotation standard finalised
|
|
168
|
+
- [ ] Base vocabulary assembled
|
|
169
|
+
- [ ] Field recording collection started
|
|
170
|
+
- [ ] Tujia ASR fine-tuning
|
|
171
|
+
- [ ] Tujia TTS training
|
|
172
|
+
- [ ] Tujia ↔ Chinese translation model
|
|
173
|
+
- [ ] Dialogue web demo
|
|
174
|
+
- [ ] LLM SFT (long-term)
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# TujiaNLP
|
|
2
|
+
利用AI技术抢救、保护濒危**北部土家语(龙山苗儿滩标准音)**
|
|
3
|
+
> 土家语目前仅高龄土家族母语者掌握,面临语言消亡风险。本开源公益项目旨在数字化留存语言资料,构建土家语AI语音、翻译与对话模型。
|
|
4
|
+
|
|
5
|
+
[English](README.md)
|
|
6
|
+
|
|
7
|
+
## 🎯 项目目标
|
|
8
|
+
1. 田野采集土家语音频,建立规范双语标注数据集;
|
|
9
|
+
2. 训练土家语ASR(语音识别)、TTS(语音合成);
|
|
10
|
+
3. 实现土家语 ↔ 汉语机器翻译;
|
|
11
|
+
4. 搭建土家语对话AI(模块化流水线先行,远期开展LLM微调);
|
|
12
|
+
5. 产出轻量化学习工具,用于土家语传承科普。
|
|
13
|
+
|
|
14
|
+
> ⚠️ 范围限定:**北部土家语(龙山/永顺/来凤片区)**,前期暂不纳入南部土家语,避免方言混杂干扰模型训练。
|
|
15
|
+
|
|
16
|
+
## 📜 书写标准
|
|
17
|
+
统一采用【叶德书-彭秀模1984土家语拼音方案】,不混用其他转写体系。
|
|
18
|
+
拼音互转由 `tujia_nlp` 包提供(`tools/orthography_convert.py` 是早期脚本,功能已并入前者)。
|
|
19
|
+
|
|
20
|
+
## 🌐 生态与分工
|
|
21
|
+
|
|
22
|
+
| 仓库 | 职责 |
|
|
23
|
+
| --- | --- |
|
|
24
|
+
| **TujiaNLP**(本仓) | 语料授权、采集规范、正字法、数据契约 |
|
|
25
|
+
| [tujia-asr](https://github.com/ibaibing/tujia-asr) | 声学模型发布:音节级 CTC |
|
|
26
|
+
| [tujia-tts](https://github.com/ibaibing/tujia-tts) | 语音合成发布 |
|
|
27
|
+
| [tujia-llm](https://github.com/ibaibing/tujia-llm) | LoRA 适配器与评测协议 |
|
|
28
|
+
|
|
29
|
+
数据流:
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
音频 ──► tujia-asr 声学模型,输出音节级结果
|
|
33
|
+
|
|
34
|
+
文本 ──► tujia_nlp IPA ↔ Ye、四调记法 ──► TTS / LLM 数据与注音
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
边界原则:
|
|
38
|
+
|
|
39
|
+
- **本仓**管语言资源与契约:音节表、正字法规则、语料授权、词典条目与包清单 schema。
|
|
40
|
+
- **tujia-asr / tujia-tts / tujia-llm** 管模型发布。训练代码在私有的 `*-lib` / `*-lab`。
|
|
41
|
+
|
|
42
|
+
## 📦 安装与使用
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pip install tujia-nlp
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
from tujia_nlp import format_syllable, normalize_shape, to_ipa, to_ye
|
|
50
|
+
|
|
51
|
+
to_ye("la35") # "laf"
|
|
52
|
+
to_ye("kaŋ35") # "gangf" 旧记法输入同样接受
|
|
53
|
+
to_ipa("gangf") # "kã35" 输出统一为现行口径
|
|
54
|
+
format_syllable("la35", "ipa") # "la³⁵"
|
|
55
|
+
normalize_shape("ʐuo") # "zuo"
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
记法约定:
|
|
59
|
+
|
|
60
|
+
- 输出(`to_ipa`)一律是现行口径:鼻化元音 `ã ẽ ĩ ũ`、`z`、`iou`。
|
|
61
|
+
- 输入(`to_ye`)两套都接受:早期材料的 `aŋ eŋ iŋ oŋ`、`ʐ`、`iu` 会先折算再查表。
|
|
62
|
+
- `ɿ`、`ə` 这类 Ye 不区分的对立只能单向:`to_ye` 能转出 Ye,`to_ipa` 不能还原。
|
|
63
|
+
|
|
64
|
+
音节表覆盖北部土家语(龙山/永顺/来凤)291 个音节,其中 227 条有语料实证、64 条按规则推断。
|
|
65
|
+
|
|
66
|
+
除 IPA ↔ Ye 之外,还有三个子模块:
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
from tujia_nlp import phone_norm, syllable, zh_sound
|
|
70
|
+
|
|
71
|
+
syllable.split_head("a⁵⁵ji²¹") # [("a", 55), ("ji", 21)]
|
|
72
|
+
syllable.tone_stats(["la³⁵"]) # 每个音节的调值分布
|
|
73
|
+
phone_norm.canon("d") # ["t"] 浊塞音并入清音类
|
|
74
|
+
zh_sound.pinyin_to_ipa("ni3") # ("ni", 21)
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
`zh_sound.text_to_syllables` 处理汉字需要可选依赖 `pypinyin`(`pip install "tujia-nlp[zh]"`),
|
|
78
|
+
纯拼音输入无需额外安装。
|
|
79
|
+
|
|
80
|
+
## 🛠️ 硬件与技术栈
|
|
81
|
+
- 开发设备:Mac Studio M2 Ultra 128GB,基于MLX实现本地离线训练/推理
|
|
82
|
+
- 语音模型:OpenAI Whisper、VITS、FishSpeech
|
|
83
|
+
- LLM底座:Qwen系列(原生适配MLX)
|
|
84
|
+
- 开发语言:Python 3.11+
|
|
85
|
+
|
|
86
|
+
## 📂 目录说明
|
|
87
|
+
```
|
|
88
|
+
src/tujia_nlp/ 包本体:tones.py、ye.py、syllable.py、phone_norm.py、zh_sound.py
|
|
89
|
+
schema/ 词典条目与包清单契约(JSON Schema)
|
|
90
|
+
tests/ 单元测试(pytest)
|
|
91
|
+
docs/ 采集规范、资源清单
|
|
92
|
+
dataset/ 语料元数据与取数脚本(不含原始数据)
|
|
93
|
+
tools/ 早期转换脚本,功能已并入包
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## 📚 公开Zenodo数据集说明
|
|
97
|
+
项目归档两套官方开源北部土家语文本语料,原始文件存放路径:`dataset/raw_zenodo/`
|
|
98
|
+
1. **V1 初代存档版(DOI:10.5281/zenodo.4446698)**
|
|
99
|
+
素材残缺、拼音映射存在标注错误,仅用于学术溯源查阅,**禁止用于模型训练**;
|
|
100
|
+
2. **V2 扩充完整版(DOI:10.5281/zenodo.4447924)**
|
|
101
|
+
本项目翻译/LLM/ASR/TTS唯一官方训练数据源,完整包含拼音对照表、词汇、课本短句、民间叙事、日常问候语。
|
|
102
|
+
|
|
103
|
+
原始数据由 Zenodo 记录 4446698 / 4447924 提供,上传者标注 `Other (Public Domain)`,该标注不是标准许可。本项目不再分发原始文件,仅提供取数脚本。经 `tools/orthography_convert.py` 转换、清洗后的标准化语料存放于 `dataset/processed/`,其许可仅覆盖本项目新增的转换与标注工作。
|
|
104
|
+
|
|
105
|
+
### 学术引用格式
|
|
106
|
+
#### V1 初代数据集
|
|
107
|
+
Zhou, Y., & Hill, N. W. (2021). A collection of North Tujia (Bifzivsar 北部土家语) vocabulary and textual passages for use in NLP (Version 1) [Data set]. Zenodo. https://doi.org/10.5281/zenodo.4446698
|
|
108
|
+
#### V2 完整版数据集
|
|
109
|
+
Zhou, Y., & Hill, N. W. (2021). A collection of North Tujia (Bifzivsar 北部土家语) vocabulary and textual passages for use in NLP (Version 2) [Data set]. Zenodo. https://doi.org/10.5281/zenodo.4447924
|
|
110
|
+
|
|
111
|
+
完整数据集许可约束详见根目录 `DATASET_LICENSE.md`。
|
|
112
|
+
|
|
113
|
+
## 🤝 如何参与贡献
|
|
114
|
+
欢迎所有志愿者参与:
|
|
115
|
+
1. 土家族同胞:协助田野录音、语义校对、发音校验;
|
|
116
|
+
2. AI/NLP开发者:模型微调、代码优化、前端工具开发;
|
|
117
|
+
3. 语言学爱好者:扩充词汇、整理语法资料。
|
|
118
|
+
|
|
119
|
+
### ⚖️ 伦理规范
|
|
120
|
+
所有田野录音必须提前获取受访者**知情同意**,严格保护老人隐私,采集素材不可私自商用。
|
|
121
|
+
|
|
122
|
+
## 📄 开源协议
|
|
123
|
+
- 程序源代码:**MIT License**(根目录 LICENSE 文件)
|
|
124
|
+
- 第三方原始语料:版权归原权利人,本项目不授予许可、不再分发,详见 `dataset/raw_zenodo/README.md`
|
|
125
|
+
- 项目自行生成的标准化数据与标注:**CC-BY 4.0**(不含原始词表全文)
|
|
126
|
+
- 田野原始音频:遵循每位受访者单独签署的知情同意约定
|
|
127
|
+
|
|
128
|
+
## 📌 项目进度清单
|
|
129
|
+
- [x] Github仓库初始化
|
|
130
|
+
- [ ] 完善《土家语数据采集与标注规范》
|
|
131
|
+
- [ ] 整理公开文献,搭建基础词汇库
|
|
132
|
+
- [ ] 启动田野录音采集
|
|
133
|
+
- [ ] Whisper增量微调 土家语ASR
|
|
134
|
+
- [ ] 训练土家语TTS语音合成
|
|
135
|
+
- [ ] 汉-土双语翻译模型
|
|
136
|
+
- [ ] 土家语语音对话Web Demo
|
|
137
|
+
- [ ] 土家语大模型SFT微调(长期目标)
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "tujia-nlp"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "Tujia orthography utilities: tone notation, IPA to Ye conversion, phone normalisation"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
authors = [{ name = "TujiaNLP contributors" }]
|
|
13
|
+
keywords = ["tujia", "tji", "orthography", "ipa", "ye", "low-resource"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"Operating System :: OS Independent",
|
|
17
|
+
"Natural Language :: Chinese (Simplified)",
|
|
18
|
+
"Topic :: Text Processing :: Linguistic",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
[project.optional-dependencies]
|
|
22
|
+
test = ["pytest>=7"]
|
|
23
|
+
zh = ["pypinyin>=0.50"]
|
|
24
|
+
|
|
25
|
+
[project.urls]
|
|
26
|
+
Homepage = "https://github.com/ibaibing/TujiaNLP"
|
|
27
|
+
|
|
28
|
+
[tool.setuptools.packages.find]
|
|
29
|
+
where = ["src"]
|
|
30
|
+
|
|
31
|
+
# The version lives in one place only: tujia_nlp.__version__.
|
|
32
|
+
[tool.setuptools.dynamic]
|
|
33
|
+
version = { attr = "tujia_nlp.__version__" }
|
|
34
|
+
|
|
35
|
+
[tool.setuptools.package-data]
|
|
36
|
+
tujia_nlp = ["data/*.json"]
|
|
37
|
+
|
|
38
|
+
[tool.pytest.ini_options]
|
|
39
|
+
testpaths = ["tests"]
|
|
40
|
+
pythonpath = ["src"]
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/ibaibing/TujiaNLP/schema/entry.schema.json",
|
|
4
|
+
"title": "Dictionary entry (one line of lexicon.jsonl)",
|
|
5
|
+
"description": "One record per line of lexicon.jsonl: w is toned IPA, p is the per-character phone sequence, g is the gloss, pg is the source locator.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": ["w", "p", "g", "pos", "pg"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"w": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"minLength": 1,
|
|
12
|
+
"description": "Toned IPA word form; tones use superscript digits, e.g. 'loŋ⁵⁵', 'a²¹pa²¹'."
|
|
13
|
+
},
|
|
14
|
+
"p": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"minLength": 1,
|
|
17
|
+
"description": "Per-character phone sequence, space separated, e.g. 'l o ŋ'; equals the cleaned and detoned w."
|
|
18
|
+
},
|
|
19
|
+
"g": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"description": "Gloss. Chinese dictionaries use Chinese; public packs may carry English only."
|
|
22
|
+
},
|
|
23
|
+
"pos": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"description": "Part of speech, one Chinese character (名/动/副/量/数/代/助/连/后缀...); empty string when unannotated."
|
|
26
|
+
},
|
|
27
|
+
"pg": {
|
|
28
|
+
"type": "string",
|
|
29
|
+
"pattern": "^[A-Za-z0-9_.-]+(#[0-9]+)?$",
|
|
30
|
+
"description": "Source locator. Single-dictionary use: 'page_0123'. Pack use: '<pack_id>#<row>', e.g. 'pack-a#1386'."
|
|
31
|
+
},
|
|
32
|
+
"src": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"description": "Source pack id. Optional for single-dictionary entries; required for provenance after merging."
|
|
35
|
+
},
|
|
36
|
+
"src_head": {
|
|
37
|
+
"type": "string",
|
|
38
|
+
"description": "Original headword in the source file, before transliteration."
|
|
39
|
+
},
|
|
40
|
+
"ye": {
|
|
41
|
+
"type": "string",
|
|
42
|
+
"description": "Yedshu-Peng (1984) spelling; optional, for display and manual checking."
|
|
43
|
+
},
|
|
44
|
+
"variants": {
|
|
45
|
+
"type": "array",
|
|
46
|
+
"items": {"type": "string"},
|
|
47
|
+
"description": "Alternative spellings or grammatical variants (future / perfect)."
|
|
48
|
+
},
|
|
49
|
+
"sense": {
|
|
50
|
+
"type": "integer",
|
|
51
|
+
"minimum": 1,
|
|
52
|
+
"description": "Sense number for the same form; identical forms from different packs keep their own sense."
|
|
53
|
+
},
|
|
54
|
+
"notes": {
|
|
55
|
+
"type": "string",
|
|
56
|
+
"description": "Free-form annotator note."
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"additionalProperties": true
|
|
60
|
+
}
|