Skip to main content

yomikata

A robot reading a book

Yomikata uses context to resolve ambiguous words in Japanese. Check out the interactive demo!

Yomikata supports 130 ambiguous forms and reaches a global accuracy of 94%. See the demo page for detailed performance information.

Yomikata follows the approach of Sato et al. 2022 by fine-tuning the Tohoku group's Japanese BERT transformer to classify words into different readings based on the sentence context. A similar approach was used in English by Nicolis et al. 2021.

Yomikata recognizes ~50% more heteronyms than Sato et al. by adding support for words which are not in the original BERT vocabulary, and it expands the original Aozora Bunko and NDL titles training data to include the core BCCWJ corpus and the KWDLC corpus.

Usage

from yomikata.dbert import dBert
reader = dBert()
reader.furigana('そして、畳の表は、すでに幾年前に換えられたのか分らなかった。')
# => そして、畳の{表/おもて}は、すでに幾年前に換えられたのか分らなかった。

This example sentence, from the short story When I Was looking for a Room to Let (1923) by Mimei Ogawa, contains the very common heteronym 表, which admits the readings omote (surface) and hyō (table). Yomikata's dBert (disambiguation BERT) correctly determines that in this sentence it refers to the surface of a tatami mat and should be read omote.

The furigana function outputs the sentence with the heteronym annotated. Readings for the other words can be obtained with a simple dictionary lookup.

from yomikata.dictionary import Dictionary
dictreader = Dictionary() # defaults to unidic.
dictreader.furigana("そして、畳の{表/おもて}は、すでに幾年前に換えられたのか分らなかった。")
# => そして、{畳/たたみ}の{表/おもて}は、すでに{幾年/いくねん}{前/まえ}に{換/か}えられたのか{分/わ}らなかった。

Without Yomikata, the dictionary outputs the wrong reading for the heteronym.

Installation

pip install yomikata
python -m yomikata download

The second command is necessary to download the model weights, which are too large to host PyPI.

Inference should work fine on CPU.

For details on data processing and training, see the main notebook.

Metadata

Release files for yomikata 0.0.4

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

Source distribution (sdist)

Source distribution for yomikata 0.0.4
File Size Uploaded
yomikata-0.0.4.tar.gz 25.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for yomikata 0.0.4
File Interpreter ABI Platform
yomikata-0.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 50.0 kB

Release files / yomikata-0.0.4.tar.gz

Download URL yomikata-0.0.4.tar.gz
Size 25.0 kB
Tags Source
SHA-256 checksum
How to use checksums
01f45e523d993fcf944765e9b261c2b553374bc92570d2499a712660c3ca3625
BLAKE2b-256 checksum
How to use checksums
e9c1b4c1e262092e1964ee498b6d863036fc79ed6386cd4427ef6994e4fb1e57
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.8

Release files / yomikata-0.0.4-py3-none-any.whl

Download URL yomikata-0.0.4-py3-none-any.whl
Size 25.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2b88804cb3fe122ec7248ae0f782e5388d5057adac062a66e4fda3807db7288a
BLAKE2b-256 checksum
How to use checksums
8dffa63ede033a7462a3c22e5a497841c92b992cc0989d6cd79f7bcc3ec738f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.8

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files

0.0.3

2 release files

0.0.2

2 release files

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