Japanese Text Cleaner

AnkiWeb addon 1852987770

Cleans unnecessary spaces and furigana in Japanese Anki text while preserving needed reading spaces and HTML, with check, diff, fix, undo, and change log safeguards.
AI-generated summary; may contain mistakes.

note-managementformatting

Open on AnkiWeb GitHub Ask about alternatives

AnkiWeb

Rating
3 (๐Ÿ‘ 3 ยท ๐Ÿ‘Ž 0)
Updated
2019-07-12
Anki versions
unknown
Description language
en

Maintenance

active

  • Last update or commit was 171 days before the snapshot (2026-04-13).
  • The repository has 2 test files.
  • The repository has 1 GitHub Actions workflows.

Will it work on my Anki?

Version branches
Min AnkiMax AnkiUpdated
2.1.0โ€“2019-07-12
History across monthly snapshots

Loadingโ€ฆ

Similar addons

Ruby Extrapolator

Parses HTML ruby furigana from Japanese expression fields into separate hiragana/reading and kanji fields for selected decks and note types, enabling better compatibility with other addons.

card-creationnote-managementformatting

Rating 0 ๐Ÿ‘ 0 ยท ๐Ÿ‘Ž 0 Anki 2.1.1~ Updated 2024-09-06
SimpleFurigana

Adds or removes furigana on Japanese Anki card content using toolbar buttons, selected-text support, and configurable HTML ruby or square-bracket readings.

card-creationformatting

Rating 34 ๐Ÿ‘ 24 ยท ๐Ÿ‘Ž 10 โญ 11 Updated 2020-09-27

README

Anki Japanese Text Cleaner

Build Status Release

This is a plugin for Anki that can help clean up Japanese text in the following ways:

Clean unnecessary spaces, while preserving those spaces that are necessary for indicating the start of a Japanese reading (as in the Japanese Support plugin).

<b> ไธ€[ใ„ใก]</b>ใ‹ใ‚‰ ๅง‹[ใฏใ˜]ใ‚ใพใ—ใ‚‡ใ†ใ€‚
=>
<b>ไธ€[ใ„ใก]</b>ใ‹ใ‚‰ ๅง‹[ใฏใ˜]ใ‚ใพใ—ใ‚‡ใ†ใ€‚

ๅฝผๅฅณ[ใ‹ใฎใ˜ใ‚‡]ใฏใ‚คใ‚ฟใƒชใ‚ข ่ชž[ใ”]ใŒ<b> ใงใใพใ™</b>ใ€‚
=>
ๅฝผๅฅณ[ใ‹ใฎใ˜ใ‚‡]ใฏใ‚คใ‚ฟใƒชใ‚ข ่ชž[ใ”]ใŒ<b>ใงใใพใ™</b>ใ€‚

Clean unnecessary furigana from the beginning, end, or within individual readings within text.

ๅˆฅใซ[ในใคใซ]
=>
ๅˆฅ[ในใค]ใซ

ไธ–ใฎไธญ[ใ‚ˆใฎใชใ‹]
=>
ไธ–[ใ‚ˆ]ใฎ ไธญ[ใชใ‹]

Both are designed to:

  • Properly handle text with multiples lines
  • Properly handle text with HTML markup by allowing HTML tags to pass through unchanged

In addition, there are some features to guard against accidental changes or bugs in the plugin:

  • A Check action logs all changes that would be made without taking any action.
  • A Diff action produces a colorful HTML diff highlighting in green what will been added and in red what will be removed for each note.
  • A 'Fix' action actually performs the changes.
  • Each batch of changes is recorded in the undo history within Anki.
  • A full change log is kept in a SQLite database within the plugin's local directory. Recent changes can be viewed in the UI and the full history of changes can be exported to a CSV file. This enables you to recover any previous values altered by the plugin.

Despite these safety features, it's a good idea to back up or export your collection before using this plugin just to be safe.

You can access the dialogs by clicking Browse to open the card browser and then clicking Edit -> Japanese Text Cleaner. The fixer dialgos require you to select some cards first. These are the cards that will be checked.

Screenshots

Dialog to check for unnecessary spacing:

<img src="https://raw.githubusercontent.com/matthayes/anki_japanese_text_cleaner/master/screenshots/check_spacing_dialog.png" width="70%">

Dialog to check for unnecessary furigana:

<img src="https://raw.githubusercontent.com/matthayes/anki_japanese_text_cleaner/master/screenshots/check_furigana_dialog.png" width="70%">

HTML diff of proposed spacing changes:

<img src="https://raw.githubusercontent.com/matthayes/anki_japanese_text_cleaner/master/screenshots/check_spacing_diff.png" width="50%">

HTML diff of proposed furigana changes:

<img src="https://raw.githubusercontent.com/matthayes/anki_japanese_text_cleaner/master/screenshots/check_furigana_diff.png" width="35%">

Viewing the log of changes:

<img src="https://raw.githubusercontent.com/matthayes/anki_japanese_text_cleaner/master/screenshots/view_log.png" width="70%">

Testing

I have tested against the following shared decks which I found on Anki's Japanese shared decks page. Below I include some stats as of July 10, 2019 when I lasted tested the plugin against the decks.

Deck Notes Field Spacing Fixes Furigana Fixes
Japanese Core 2000 2k - Sorted w/ Audio 2007 Reading 266 1
Japanese Visual Novel, Anime, Manga, LN Vocab - V2K 1988 Reading 4 55

To get a better idea about how the plugin works, I've included some examples from each deck.

Examples: Japanese Core 2000 2k

Unnecessary space removed from beginning of line:

<b> ไธ€[ใ„ใก]</b>ใ‹ใ‚‰ ๅง‹[ใฏใ˜]ใ‚ใพใ—ใ‚‡ใ†ใ€‚
=>
<b>ไธ€[ใ„ใก]</b>ใ‹ใ‚‰ ๅง‹[ใฏใ˜]ใ‚ใพใ—ใ‚‡ใ†ใ€‚
<b> ๆœˆๆ›œๆ—ฅ[ใ’ใคใ‚ˆใ†ใณ]</b>ใซ ไผš[ใ‚]ใ„ใพใ—ใ‚‡ใ†ใ€‚
=>
<b>ๆœˆๆ›œๆ—ฅ[ใ’ใคใ‚ˆใ†ใณ]</b>ใซ ไผš[ใ‚]ใ„ใพใ—ใ‚‡ใ†ใ€‚

Unnecessary space removed from within line:

ๅฝผๅฅณ[ใ‹ใฎใ˜ใ‚‡]ใฏใ‚คใ‚ฟใƒชใ‚ข ่ชž[ใ”]ใŒ<b> ใงใใพใ™</b>ใ€‚
=>
ๅฝผๅฅณ[ใ‹ใฎใ˜ใ‚‡]ใฏใ‚คใ‚ฟใƒชใ‚ข ่ชž[ใ”]ใŒ<b>ใงใใพใ™</b>ใ€‚

Redundant furigana removed from end of word:

ๅฝผๅฅณ[ใ‹ใฎใ˜ใ‚‡]ใฏใ‚ˆใ<b>ๅ–‹ใ‚‹[ใ—ใ‚ƒในใ‚‹]</b>ใญใ€‚
=>
ๅฝผๅฅณ[ใ‹ใฎใ˜ใ‚‡]ใฏใ‚ˆใ<b>ๅ–‹[ใ—ใ‚ƒใน]ใ‚‹</b>ใญใ€‚

Examples: Japanese Visual Novel, Anime, Manga, LN Vocab

Redundant furigana removed from the end:

ๅˆฅใซ[ในใคใซ]
=>
ๅˆฅ[ในใค]ใซ
็–ฒใ‚Œใ‚‹[ใคใ‹ใ‚Œใ‚‹]
=>
็–ฒ[ใคใ‹]ใ‚Œใ‚‹
็›ธๅค‰ใ‚ใ‚‰ใš[ใ‚ใ„ใ‹ใ‚ใ‚‰ใš]
=>
็›ธๅค‰[ใ‚ใ„ใ‹]ใ‚ใ‚‰ใš

Redunant furigana removed from the middle:

ๅฝ“ใŸใ‚Šๅ‰[ใ‚ใŸใ‚Šใพใˆ]
=>
ๅฝ“[ใ‚]ใŸใ‚Š ๅ‰[ใพใˆ]
ๆŒฏใ‚Š่ฟ”ใ‚‹[ใตใ‚Šใ‹ใˆใ‚‹]
=>
ๆŒฏ[ใต]ใ‚Š ่ฟ”[ใ‹ใˆ]ใ‚‹
ไธ–ใฎไธญ[ใ‚ˆใฎใชใ‹]
=>
ไธ–[ใ‚ˆ]ใฎ ไธญ[ใชใ‹]

Unnecessary space removed:

ๆฏ[ใฏใ„],   ๆฏ[ใ•ใ‹ใšใ]
=>
ๆฏ[ใฏใ„], ๆฏ[ใ•ใ‹ใšใ]

Version History

  • 0.1: Initial Release

License

Copyright 2019 Matthew Hayes

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.