jpreprocess

Library Listed

Japanese text preprocessor for Text-to-Speech application (OpenJTalk rewrite in rust language).

Checked · Sources

Downloads
14,491
Dependents
7
Stars
61
Forks
7
Contributors
4
Commits
808
Latest release
0.15.0 ·

About

From the project README ·

日本語音声合成の前処理を行うライブラリです.日本語文を解析し,フルコンテキストラベルを生成します.

OpenJTalkの前処理部分をRustで書き直したものです.なお,(前処理ではない)音声合成部分については,jpreprocess/jbonsaiにて再実装・最適化を行っています.

実装の概要

日本語の音声合成にはいくつかの手法がありますが,著名なライブラリであるOpenJTalkでは,以下の三段階で合成する方法がとられています.

  1. 形態素解析:巨大な辞書を用いて,文章を単語ごとに分けます.さらに辞書には各単語の品詞,読み,アクセント等が書かれていますので,これらの情報を抜き出します.OpenJTalkでは形態素解析ライブラリMecabを用いています.
  2. 文章の前処理:単語には前後の単語によって読みが変わるものがあります.数字の読み(10000→いちまん,など)は代表的ですが,他にもアクセント位置が移動したり,母音が無声化したりすることがあります.前処理ではこれらをルールベースで処理して反映します.
  3. 音声合成:2.までで判明した読み・アクセント・品詞などの情報をもとに,音声波形を合成します.OpenJTalkではこの部分を同グループが開発したhts_engine APIが担っています.

最近では,これをさらに発展させ,1.と2.はそのままMecab/OpenJTalkを用いつつ,音声合成部分のみを深層学習モデルに置き換えて性能を向上させることが行われています.

このような背景を踏まえ,本リポジトリでは1.と2.の部分に絞ってRustで再実装しています(ただし,1.は,その実質を形態素解析ライブラリ Linderaに依存しています).さらに,2.の出力は,jlabelのjlabel::Label構造体として取り出すことができ,必要であれば従来通りのテキスト形式のフルコンテキストラベルに変換することができます.

残る3.の部分については,jpreprocess/jbonsaiにて再実装・最適化を行っています.したがって,jpreprocessとjbonsaiを組み合わせると,(広義)Open JTalk類似の音声合成を行うことができます.具体的な実装方法については,discordjs-japan/om-syrinxが参考になるかもしれません(jbonsaiのストリーミング合成機能を利用しているため,やや複雑になっています).

Read the full README
目標
  • (形態素解析部分)
    • Raspberry piなどメモリの限られた環境で使うことを考慮し,独自の辞書形式(jpreprocess辞書)によりメモリ上の辞書ファイルのサイズを削減する.
    • 一方,他の形態素解析エンジンとの互換性を維持するため,文字列(CSV)での入力も可能にする.
  • (前処理部分)
    • OpenJTalkのコードをそのまま読み替えるのではなく,できるだけ読みやすく,書きやすい構造にする.
    • バグと思われる一部の挙動を除き,OpenJTalkと全く同じ出力(フルコンテキストラベル)を得ることができる.
      • たとえば「特殊助動詞」や紛らわしい2,2,3桁区切りの数字の読み方は,OpenJTalkと異なります.
      • ただし,OpenJTalkになかった機能を追加する場合もあります.その場合でも,OpenJTalkと同じ結果を得る手段が残るようにします.

Crates

ドキュメンテーションについては,docs.rsを参照してください.

jpreprocess

主要なインターフェースです.入力された日本語文の正規化を含みますが,それ以外の部分はLindera,jpreprocess-njd,jpreprocess-jpcommonなどのラッパーになっています.形態素解析の結果は,jpreprocess-coreで規定されるデータ構造で保持します.

例:

use jpreprocess::*;

let system = SystemDictionaryConfig::File(path).load()?;
let jpreprocess = JPreprocess::with_dictionaries(system, None);

let jpcommon_label = jpreprocess
    .extract_fullcontext("日本語文を解析し、音声合成エンジンに渡せる形式に変換します.")?;
assert_eq!(
  jpcommon_label[2].to_string(),
  concat!(
      "sil^n-i+h=o",
      "/A:-3+1+7",
      "/B:xx-xx_xx",
      "/C:02_xx+xx",
      "/D:02+xx_xx",
      "/E:xx_xx!xx_xx-xx",
      "/F:7_4#0_xx@1_3|1_12",
      "/G:4_4%0_xx_1",
      "/H:xx_xx",
      "/I:3-12@1+2&1-8|1+41",
      "/J:5_29",
      "/K:2+8-41"
  )
);
jpreprocess-core

発音,単語,品詞,JPCommon等のデータ構造と,それに関連する関数群,エラーを表現する構造を含みます.なお,posはPart Of Speechの頭字語で,「品詞」を表します.

jpreprocess-dictionary

「jpreprocess辞書」の生成と読み込みを行います.また,実行時には読み込んだ辞書がLinderaの辞書か,jpreprocess辞書かどうかを自動で判定します.

jpreprocess辞書は,辞書に文字列として記述された品詞等の単語情報を前処理し,jprpeprocess-coreのデータ形式に高速に展開できるバイナリ形式にしたものです.その他の部分(double array等)はLinderaの辞書とほとんどの部分で同じですが,Open JTalkとの互換性のため,同一の重みをもつ単語の優先順位がLinderaと逆順になっています.

加えて,Lindera辞書/jpreprocess辞書のビルドを行うためのdict_toolsツールもここで実装されています.

jpreprocess-naist-jdic

実行時のバイナリに,naist-jdic辞書から生成したjpreprocess辞書を組み込みます.jpreprocessクレートでnaist-jdic featureを有効にすると利用できます.

なお,naist-jdic featureを有効化すると,マシンにもよりますがビルドに数分かかることがあります.

jpreprocess-njd

OpenJTalkでいうNJDNode,NJDの構造を定義し,NJDに対する変換処理を行います.

具体的には,数字の読み方を変換したり(たとえば「10,120」を「いちまんひゃくにじゅう」),アクセント位置を推定したりします.

jpreprocess-jpcommon

OpenJTalkでいうJPCommonLabelの構造を定義し,NJDからJPCommon,さらにJPCommonからフルコンテキストラベルへの変換を行います.

jpreprocess-window

jpreprocess-njdの変換処理で使われる,mutableなwindowを実装します.

Copyrights

This software includes source code from:

  • OpenJTalk. Copyright (c) 2008-2016 Nagoya Institute of Technology Department of Computer Science
  • Lindera. Copyright (c) 2019 by the project authors

License

BSD-3-Clause

Runs on
GPU support unknown
What shows it
  • no dependency or feature matches a backend row
Native code
None found
  • No native code found
Python bindings
No Python binding crate found
License
BSD-3-Clause

Compare with similar projects

Order: strongest tier first, then most downloads, then name, with unmeasured values last. A library counts downloads over 30 days. An app counts binary downloads per release. An app with none counts its crate downloads over 30 days. ML Rust runs this catalogue, so its closest project always gets a row.

jpreprocess beside the projects that share a topic with it
ProjectDownloadsDependentsStarsLatest releaseRuns on (GPU)Native codeLicense
jpreprocess This page Listed

Japanese text preprocessor for Text-to-Speech application (OpenJTalk rewrite in rust language).

14,491 downloads over 30 days 7 61 0.15.0 GPU support unknown No native code found BSD-3-Clause
sherpa-onnx Featured

Safe Rust wrapper for sherpa-onnx speech recognition toolkit

259,599 downloads over 30 days 28 15,834 2.0.1 GPU support unknown Binds native code: sherpa-onnx, sherpa-onnx-sys Apache-2.0
aspeak App Listed Dormant

A simple text-to-speech client for Azure TTS API.

Python bindings

488 binary downloads per release Not applicable 496 6.1.0 GPU support unknown No native code found MIT
qwen3_tts_rs App Listed

A Rust implementation of the Qwen3 Text-to-Speech (TTS) model inference.

204 binary downloads per release Not applicable 237 Not measured Not measured None stated

Rust implementation for the CohereLabs/cohere-transcribe-03-2026 speech-to-text model. Includes a CLI and an OpenAI-compatible API server.

0 downloads over 30 days 0 101 0.1.1 CUDA Binds native code: torch-sys (feature tch-backend). Build uses a native toolchain: cmake Apache-2.0

Rust bindings for transcribe.cpp, a C/C++ speech-to-text library built on ggml

50,251 downloads over 30 days 3 2,149 0.4.1 CUDA, Metal, ROCm, Vulkan Binds native code: transcribe, transcribe-cpp-sys, transcribe_cpp. Build uses a native toolchain: cmake MIT
voxr New

Audio and speech on boostr: compressed-audio decode, resampling, DSP and grapheme to phoneme, with speech synthesis (Kokoro, VITS), voice cloning (VoxCPM2), transcription with word timings (Whisper), voice activity (Silero) and audio-text scoring (CLAP), on CPU or CUDA.

642 downloads over 30 days 2 2 0.9.1 CUDA No native code found Apache-2.0
Why ListedNo archive, New or Featured rule places it, so it is Listed.

What it lacks for Featured

  • It has 3 active dependents and 3 new dependents in 365 days. Featured needs 11 active dependents or 9 new dependents in 365 days. The repository route reads 61 stars, 7 forks and 4 contributors. It needs 4,539 stars, 434 forks and 79 contributors together.

What else the check found

  • The last activity is on 25 Jun 2026, 137 days ago. The rules expect an update within 365 days. Dormancy rule

Exact rules: Listed, Featured library. The check on applied thresholds version 9.

Every rule outcome, as the check records it
  • expected-interval: version 0.15.0 base 140, raised to the 365-day floor: E = 365 days
  • dormancy: last activity 2026-06-25, 137 days ago, E = 365: active
  • featured: not featured: active_users 3 < 11 and new_adopters 3 < 9 and repository route stars 61 (needs 4539), forks 7 (needs 434), contributors 4 (needs 79)
  • listed: listed: no archive, new or featured rule applies
Crates8 crates

Measurements and sources

Each signal row shows the raw value, its source and the fetch date. The Sources list gathers every distinct source on this page. Movement needs more history.

Sources6 sources
Adoption3 active dependents, 3 new dependents in 365 days1 not measured
Adoption measurements
SignalValueSourceFetchedCounts
Active dependents3crates.io database dumpYes
New dependents (365 days)3crates.io database dumpYes
Peak active dependents4crates.io database dumpYes
Active dependents as a share of the peak1crates.io database dumpYes
Binary downloads per releaseNot measuredYes
MaintenanceLatest human commit: 4 months ago3 not measured
Maintenance measurements
SignalValueSourceFetchedCounts
Latest human commit2026-06-25GitHub repositoryYes
Latest release2026-06-11crates.io database dumpYes
First release2023-06-01crates.io database dumpYes
Latest version0.15.0crates.io database dumpYes
Days the oldest outside issue waits for a reply0GitHub repositoryYes
Maintainer replies over 365 days14GitHub repositoryYes
Repository archivedfalseGitHub repositoryYes
Repository gonefalseGitHub repositoryYes
Release commit or manifest in the repotruecrates.io packageYes
Published docstruecrates.io database dumpYes
Latest release fails cargo checkNot measuredYes
Build check dateNot measuredYes
Build check toolchainNot measuredYes
SecurityUnpatched vulnerabilities: none
Security measurements
SignalValueSourceFetchedCounts
Unpatched vulnerabilities past the grace windownoneRustSec advisory databaseYes
RustSec unmaintained advisorynoneRustSec advisory databaseYes
Deprecation noticenonecrates.io database dumpYes
Deprecated requirementnonecrates.io database dumpYes
Distribution24 releases, 14,491 downloads over 30 days5 not measured
Distribution measurements
SignalValueSourceFetchedCounts
Releases24crates.io database dumpYes
Downloads over 30 days14491crates.io database dumpYes
Binary downloads over the last 3 releasesNot measuredYes
Homebrew installs on request over 365 daysNot measuredYes
Repology repository familiesNot measuredYes
Docker pull growth over 90 daysNot measuredYes
Docker pulls at the growth baselineNot measuredYes
Every version a prereleasefalsecrates.io database dumpYes
Every version 0.0.xfalsecrates.io database dumpYes
Every version yankedfalsecrates.io database dumpYes
Crate deleted from crates.iofalsecrates.io database dumpYes
Repository61 stars, 7 forks, 4 contributors, 808 commits. Stars alone never qualify a project.
Repository measurements
SignalValueSourceFetchedCounts
GitHub stars61GitHub repositoryYes — one part of the repository route
GitHub forks7GitHub repositoryYes — one part of the repository route
Contributors with a GitHub account4GitHub contributorsYes — one part of the repository route
Commits on the default branch808GitHub repositoryNo
Repository's main crate left out of the entrynonecrates.io database dumpYes
Facts that never count
Facts that never count measurements
SignalValueSourceFetchedCounts
LicenseBSD-3-Clausecrates.io database dumpNo
Runs on, from listed crates and their direct dependenciesGPU support unknowncrates.io database dumpNo
What shows each backendno dependency or feature matches a backend rowcrates.io database dumpNo
Native code, from listed crates and their dependenciesNo native code foundcrates.io database dumpNo
Python bindings, from direct dependencies of listed cratesNo Python binding crate foundcrates.io database dumpNo
Crates that depend on a listed crate directly7crates.io database dumpNo

Corrections and review history

Report a correction

No correction applies to this entry.

Judgments

A judgment enters only through an approved issue and a merged pull request.

No judgment applies to this entry.