19 4
Sign in to rate

Pinyin on top of Hanzi

10.83MB. Updated 2018-01-31.
The author has shared 2 other item(s).

This item is large, and may take some time to download.


For the source code, the GitHub link. In a nutshell, this addon turns into The way the addon achieves this is really quite simple. At its core is the recent addition of ruby characters to HTML. Here is a part of above example's ruby HTML: <ruby>老师<rt>lǎo shī</rt></ruby>. Because it's pure HTML we can directly add the ruby to one of the note's fields. Make sure to add a field beforehand to your note, as the addon can (currently) only work with existing fields. The addon works whether you already have matching Pinyin. It helps to have matching Pinyin, but the addon is smart enough to generate (usually correct) Pinyin on its own. The interface was designed for ease of use. After installation, to start the Pinyin generation, go to Tools → Chinese tools → Pinyin helper. Then choose the deck, note type, and field with the Hanzi characters. If you already have a field with matching Pinyin, select the first option. The addon will match Hanzi and Pinyin together to the best of its ability. You can preview the output by selecting any one of the Hanzi on the left (from your own cards) and see the matched Hanzi and Pinyin on the right. Make sure to select a field for where the ruby output should go. Here is an example of the addon generating Pinyin when there is no pre-existing Pinyin to match with the Hanzi. The addon goes beyond assigning Pinyin to individual Hanzi, which is error-prone — there are many Hanzi with multiple Pinyin readings. It instead first splits the Hanzi sentence (in which there are usually no spaces) into words, then looks up each word in an internal dictionary. While it may make the occasional mistake it is remarkably adept at assigning the right Pinyin. There is also the option of generating a table of definitions from the internal dictionary: The addon restricts the dictionary entries to match the Pinyin readings, which it finds in the note if you specified a Pinyin field, or generates on its own if you haven't. The dictionary entries are also entirely in HTML, and come with CSS selectors for the word, Pinyin, and definitions columns. Remember to specify another field in the note where the table of definitions will go. This addon would not have been possible without two third-party Python modules. I've used as well as the free Chinese dictionary CEDICT. Everything is bundled in the addon, which explains its large download size. Notes


As add-ons are programs downloaded from the internet, they are potentially malicious. You should only download add-ons you trust.

Supported Anki versions:

To download this add-on, please copy and paste the following code into Anki 2.1:


If you were linked to this page from the internet, please open Anki on your computer, go to the Tools menu and then Add-ons>Browse & Install to paste in the code.

All Anki 2.1.x Add-Ons


on 1652974833
It certainly does what it says in the description - adds pinyin on top of hanzi, but you might run into a problem if you constantly update your deck - the addon adds pinyin indiscriminately. In other words, you will get a new line of pinyin on top of the previous one each time you use the addon.
on 1641370688
Great add-on ~

For people saying you should put pinyin in a separate field - I routed the output so that the raw hanzi is on the question side of the card, and the pinyin+hanzi is generated on a separate field on the answer side.
on 1633870389
Fantastic add-on, thank you so much
on 1622604643
Amazing add-on. Thank you!
on 1616682248
I think it does the job, however, you can't undo your preferences. so if you misclicked well you're out of luck and have to redo the cards you overwrote with this add-on. I wanted to undo the changes because the add-on didn't quite work with clozed type notes. it displayed the pinyin after each typed in hanzi
on 1615051298
amazing add-on! i recommend pairing this add-on with the lingoes pop-up dictionary for max efficiency and ease doing your anki reviews https://choronghi.wordpress.com/2021/02/02/subs2srs-anki-plugins-dictionaries-authotkey/

lingoes: search chinese
on 1613537649
Here's a space-saving theme for the dictionary table:
.dict-table-word, .dict-table-pinyin, .dict-table-definition {-font-size:50%;}
table {border-collapse: collapse;}
.dict-table-word-border {border-top: 1px solid lightgrey;}
.dict-table-word {white-space: nowrap;}
.dict-table-definition ol {text-align:left; margin:0; padding:0;}
.dict-table-definition li {display: inline-block;}
.dict-table-definition li::before {content: "• ";}
ruby {ruby-position: under;} rt {display:table-cell;}
try {
/* move the second column above the first column */
for (word of document.querySelectorAll(".dict-table-word"))
on 1608500716
holy crap. this plus wordquery (for j-k-e dictionaries as well as when pinyin on top of hanzi doesn't parse correctly which is RARE), subs2srs decks, morphman (priority.db etc), Search cards based on length, Automatically show answer after X seconds have made learning mandarin very easy and fun! https://massimmersionapproach.com/table-of-contents/anki/morphman/ I'm all for avoiding manually copy pasting and clicking crap 5 billion times!


wordquery autohtokey script https://www.reddit.com/r/ChineseLanguage/comments/d054pv/authotkey_scripts_for_wordquery_plugin_in_anki/
on 1608376558
Such a great Add on, thank you very much
on 1591964733
This is really good though i have a question, once I click close for adding cards in a deck, then using the pinyin helper (I click on the generate for all cards, replacing existing pinyin), the problem is when i make new cards and apply the same add-on it adds a second line of pinyin for my previous cards that I already used the add-on to, so essentially it is not replacing existing pinyin, what is the solution for this?
on 1588667662
As a (Windows) How-To see Anki forum:
"Pinyin on top of Hanzi (417709332) - getting started"


It works!
on 1573570534
Doesn't work with traditional characters. What a shame.
on 1572893761
tip if you have text that happens to have spaces between the words in hanzi, if you replace the space with \ this plugin will parse better. i don't think you can find and replace it in anki (you'd have to export, import etc )
on 1569282567
hi this looks like a great addon but because of my stupid mistake i apply this and now my front card has all the pinyin and i cant practice reading them anymore... i only have 1 question, how do i remove pinyin above hanzi? i can manually remove them but i have 2k cards affected by this... is this the only way??
on 1565273718
Great idea, but I found it doesn't work on complicated sentences. A lot of times the add-on gets confused wether a character is related to the character before or after. Also, when I add pinyin to a sentence, some characters just disappear. Would be awesome if we could just select the words we wanted to generate pinyin for in the "Add card" editor!
on 1564248259
Is anyone else here trying to install the anki 2.0 version of this add-on that is found in the Github link above?

I don't know whether the interface is different with this version, or if I am simply not installing it correctly when I manually put the file into the add-on folder.

Any help would be much appreciated...
on 1555020501
It's the most useful Chinese addon available.
on 1541414364
Works really well!
on 1535166333
Love it!
on 1525305600
Thank you for the Add-on, but I am not able to download it. Error message:

"Download failed: Error downloading: 404"

I am able to install other add-ons though. Could you please take a look? Thank you so much!
on 1525046400
Haven't tried this yet, seems like a GOD idea.
on 1518220800
Addon is quite useful. Much more aesthetic than separate fields.
Though in my opionion the pinyin should not written to the hanzi field, but instead still added as separate pinyin field.
This way you can train to read the hanzi.
The addon allows this. But maybe the default configuration or the documentation should mention this.
Also, better have a working backup before applying the update, the hanzi fields get overrridden.
on 1517529600
Really cool!

I don't use Anki for learning Chinese, but I'll definitely be recommending this add-on to other users. Great job!

– G