Skip to main content

misaki

Misaki is a G2P engine designed for Kokoro models.

Hosted demo: https://hf.co/spaces/hexgrad/Misaki-G2P

English Usage

You can run this in one cell on Google Colab:

!pip install -q "misaki[en]"

from misaki import en

g2p = en.G2P(trf=False, british=False, fallback=None) # no transformer, American English

text = '[Misaki](/misˈɑki/) is a G2P engine designed for [Kokoro](/kˈOkəɹO/) models.'

phonemes, tokens = g2p(text)

print(phonemes) # misˈɑki ɪz ə ʤˈitəpˈi ˈɛnʤən dəzˈInd fɔɹ kˈOkəɹO mˈɑdᵊlz.

To fallback to espeak:

# Installing espeak varies across platforms, this silent install works on Colab:
!apt-get -qq -y install espeak-ng > /dev/null 2>&1

!pip install -q "misaki[en]" phonemizer-fork

from misaki import en, espeak

fallback = espeak.EspeakFallback(british=False) # en-us

g2p = en.G2P(trf=False, british=False, fallback=fallback) # no transformer, American English

text = 'Now outofdictionary words are handled by espeak.'

phonemes, tokens = g2p(text)

print(phonemes) # nˈW Wɾɑfdˈɪkʃənˌɛɹi wˈɜɹdz ɑɹ hˈændəld bI ˈispik.

English

Japanese

The second gen Japanese tokenizer now uses pyopenjtalk with full unidic, enabling pitch accent marks and improved phrase merging. Deep gratitude to @sophiefy for invaluable recommendations and nuanced help with pitch accent.

The first gen Japanese tokenizer mainly relies on cutlet => fugashi => mecab => unidic-lite, with each being a wrapper around the next. Deep gratitute to @Respaired for helping me learn the ropes of Japanese tokenization before any Kokoro model had started training.

Korean

The Korean tokenizer is copied from 5Hyeons's g2pkc fork of Kyubyong's widely used g2pK library. Deep gratitute to @5Hyeons for kindly helping with Korean and extending the original code by @Kyubyong.

Chinese

The second gen Chinese tokenizer adapts better logic from paddlespeech's frontend. Jieba now cuts and tags, and pinyin-to-ipa is no longer used.

The first gen Chinese tokenizer uses jieba to cut, pypinyin, and pinyin-to-ipa.

Vietnamese

TODO

  • Data: Compress data (no need for indented json) and eliminate redundancy between gold and silver dictionaries.
  • Fallbacks: Train seq2seq fallback models on dictionaries using this notebook.
  • Homographs: Escalate hard words like axes bass bow lead tear wind using BERT contextual word embeddings (CWEs) and logistic regression (LR) models (nn.Linear followed by sigmoid) as described in this paper. Assuming trf=True, BERT CWEs can be accessed via doc._.trf_data, see en.py#L479. Per-word LR models can be trained on WikipediaHomographData, llama-hd-dataset, and LLM-generated data.
  • More languages: Add ko.py, ja.py, zh.py.
  • Per-language pip installs

Acknowledgements

misaki

Metadata

Release files for bookvox-misaki 0.9.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bookvox-misaki 0.9.5
File Size Uploaded Provenance Actions
bookvox_misaki-0.9.5.tar.gz 3.8 MB Without provenance Details for bookvox_misaki-0.9.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bookvox-misaki 0.9.5
File Interpreter ABI Platform Actions
bookvox_misaki-0.9.5-py3-none-any.whl Python 3 none any Details for bookvox_misaki-0.9.5-py3-none-any.whl

Total release size: 7.4 MB

Release files / bookvox_misaki-0.9.5.tar.gz

Download URL bookvox_misaki-0.9.5.tar.gz
Size 3.8 MB
Tags Source
SHA-256 checksum
How to use checksums
8adb88384375ce8cce7cbdaf10b9b2f689144363984f84ff0c1a2d7bcb512248
BLAKE2b-256 checksum
How to use checksums
a72cee4e73544b7081071cbeaf9fcd53d1085b3b3d9266d5b8bdf2e1ed8a2ba9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Release files / bookvox_misaki-0.9.5-py3-none-any.whl

Download URL bookvox_misaki-0.9.5-py3-none-any.whl
Size 3.6 MB
Tags Python 3
SHA-256 checksum
How to use checksums
a4f2a816c02eff468a8364faddf3993ad97e18e1cd548244f23efad376bf030b
BLAKE2b-256 checksum
How to use checksums
90df0d1abdc6ad671280db06c07df99f6e788d72395db941f193ea348954f363
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Security for bookvox-misaki 0.9.5

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.

Release history Release notifications | RSS feed

This release

0.9.5 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page