hatsuon
Japanese pronunciation scoring for read-aloud speech, on the CPU. It scores accuracy per mora, the special morae (っ, ん, long vowels) and Tokyo pitch accent.
Status: alpha (0.1). Thresholds were tuned on native speech only (JSUT/JVS), and no L2 learner data has been used yet. Treat the scores as feedback, not as a grade. Design and tuning records: docs/SPEC.md and
calibration/default.json.
Install
pip install "hatsuon[all]"
The acoustic model is not shipped in the package. Convert it once on your machine. This step needs PyTorch and transformers only for the conversion itself:
pip install "hatsuon[export]"
hatsuon-export # writes ~/.cache/hatsuon/models/... (ONNX, int8)
hatsuon-export --out DIR writes the model elsewhere; set HATSUON_MODEL_DIR=DIR
to use it. --no-quantize keeps FP32 weights.
Use
import hatsuon
r = hatsuon.score("learner.wav", "東京に行きます。")
print(r.overall, r.accuracy, r.completeness, r.pitch, r.timing, r.confidence)
for w in r.words:
print(w.surface, w.reading, w.score, w.accent.value)
for m in w.morae:
print(" ", m.kana, m.status.value, round(m.score), m.duration, m.pitch_status)
print([x.value for x in r.warnings])
audiocan be a path, encoded bytes, or a(samples, sample_rate)tuple.- Ambiguous readings:
reading="きょう"(whole text) orreading={"今日": "きょう"}. - Accent overrides:
accent={"箸": 1}(0 = heiban, n = fall after mora n). pitch=Falseortiming=Falseskips those stages.debug=Trueattaches F0, the free decode and per-phone GOP tor.debug.- Soft problems such as
no_speech,content_mismatchorpitch_unreliablecome back inr.warningsand lowerr.confidence. - Hard errors raise
hatsuon.AudioErrororhatsuon.TextError.
Known limitations (0.1)
- Native-only calibration. We have not yet measured mispronunciation recall
on learners. On 20 held-out JVS speakers, 0.6% of correct native morae fall
below the
mispronouncedthreshold. Synthetic one-mora substitutions (the text is changed, the audio is not) are caught 94% of the time: 98% for consonants and 91% for vowels. Real learner errors are subtler than these. - Pitch accent:
- Native speakers often place the F0 peak one mora late, so a fall up to one mora after the nucleus is accepted. As a result, a learner who puts the nucleus one mora too late is not caught.
- About 9% of native heiban phrases are flagged with a false fall.
- Readings come from OpenJTalk. When it misreads a word (proper nouns,
命 → イノチ when the speaker says めい), a correct reading shows up as
deletedmorae. Passreading={"命": "めい"}in those cases. - Read speech only. Not for spontaneous speech or singing.
Development
pip install -e ".[all,dev]"
pytest && ruff check .
bash tools/fetch_data.sh # JSUT, JVS, jsut-label into data/ (see DATA_SOURCES.md)
python tools/eval_accent.py --n 300 # pitch-accent accuracy on JSUT
python tools/calibrate.py collect && python tools/calibrate.py fit --write
License
MIT. Corpora and the acoustic model have their own licences and are never redistributed. See DATA_SOURCES.md.
Metadata
Release files for hatsuon 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| hatsuon-0.1.0.tar.gz | 69.2 kB | Without provenance | Details for hatsuon-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hatsuon-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for hatsuon-0.1.0-py3-none-any.whl |
Total release size: 108.3 kB
Release files / hatsuon-0.1.0.tar.gz
| Download URL | hatsuon-0.1.0.tar.gz |
|---|---|
| Size | 69.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
305a25a6458bd13f06804137e6742a3694e7c5531bc316ddc7a17ec248a864a7
|
|
BLAKE2b-256 checksum How to use checksums |
180bf5d7b9b13c2c1119349904e0d13754630a7bd15643d71d42f0525f3d2485
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.18
|
Release files / hatsuon-0.1.0-py3-none-any.whl
| Download URL | hatsuon-0.1.0-py3-none-any.whl |
|---|---|
| Size | 39.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
efbfed97a74f9c87fe77a278f6e8e8296c50454933cf2ed8222821d9e0a6e5f5
|
|
BLAKE2b-256 checksum How to use checksums |
692fa1c1bd3e199cd4e453f4757e33051a8bce8eb4e0d500eac33d9a2a38fa17
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.18
|
Security for hatsuon 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.