As an undergraduate student relying heavily on Anki4 for both my major and for studying Japanese, I wrote several blog-posts throughout 2016 on how I’ve personally integrated Anki in my daily life. One of those entries extensively documented how I’ve connected Anki with Firefox to vocab-mine Japanese texts in my browser with JPod101 audio-readings, example-sentences (a method crucial to my language-acquisition) and Japanese dictionary definitions. Although I’ve had little time to update my blog throughout 2018, those specific posts became somewhat high-ranking when googling things concerning Anki. Unfortunately, Firefox-updates led to Anki-integrated Firefox pop-up dictionary Rikaisama (the plug-in I’ve relied on for years) becoming obsolete. Thus it was high time to update my humble guide to reflect the current state of affairs on the elusive ‘browser + Anki’ integration-methods available today.


So it’s 2019, wasting valuable time on automatable processes bores you and you’re keen on integrating technology more efficiently in your Japanese language-acquisition. Concretely you want to:

  • Vocab-mine Japanese texts you’re reading both on- and off-line using Chrome or Firefox.
  • Improve your retention-rate with hidden furigana reading-aids and crystal-clear Jpod101 audio-readings.
  • Contextualize your cards with Japanese example sentences.
  • Rely Not just solely on foreign-language translations, but use Japanese dictionary definitions for optimized studying.

Basically, you want cards like this:

center border

What options are available then, sans going all the way and developing said tools yourself?

  1. If you’ve previously used the Rikaisama pop-up dictionary and followed my previous guides, you can continue doing so using a Firefox-derived browser. I still recommend this method for longer texts such as novels. Head to section Rikaisama.
  2. If you’re new to this site or method, use the Chrome / Firefox add-on Yomichan. It’s user-friendly, highly adjustable and has tons of features. Head to section Yomichan.

Yomichan

Developed by Foosoft Productions - a household name amongst the Anki-utilizing on-line learning community - Yomichan originated as a stand-alone bookreader with Anki-integration, until it in its current form became the most complete alternative available for Rikaisama.

In similar fashion to Rikaisama, we’ll use Yomichan to vocab-mine Japanese texts and generate extensive Anki-cards with Jpod101 audio-readings, example sentences, furigana, and Japanese definitions. Furthermore, for ex-Rikaisama users, Yomichan definitely has the upper hand concerning user-friendliness and adaptability.

Set-up

Another benefit of this plug-in is that it’s cross-platform, available both on Firefox and Chrome. Pick your platform of choice and after installing we’ll start the initial set-up.

It’s worth checking out Yomichan’s homepage as it contains an extensive manual. This guide will focus purely on connecting Yomichan to Anki, setting up a proper template for our cards, and integrate generation of example sentences and Japanese definitions.

NOTE: Yomichan can’t parse off-line files out-of-the-box. If you’re inclined to use Yomichan with off-line files (when reading HTML-formatted novels for example), just head to the Chrome/Firefox settingsextensions page and manually allow the add-on to access file URLs.

Dictionaries

First, download the libraries to your liking and add them in the Yomichan settings page.

Anki-integration

To integrate Yomichan into Anki, we’ll need to install Anki-Connect, an Anki plug-in specifically tailored to Yomichan. Open Anki on your desktop, go to ToolsAdd-onsBrowse & Install, and copy-paste 2512410601 in the pop-up dialog.

Now, we’ll create a new set to contain our Yomichan-powered cards. We want cards containing the expression (and hover-able furigana reading), its definition in our language of choice, audio readings and example sentences. For this, we’ll create a new ‘note-type’ with fields corresponding to the info we’d like to see in our cards. We probably want to be tested both on the Japanese expression (visual recognition), on its meaning (production) and finally on the audio (oral recognition). To achieve this, we’ll add three ‘card-types’ to our ‘note-type’.4

Start by creating a new ‘set’, eg. yomi-vocab[^4]. On Windows, press CTRL-SHIFT-N, or click ToolsManage Note Types, to enter the ‘note-type’ management screen. Click addok to create a new ‘note-type’. Call it Yomichan.

center border

Next, select the new Yomichan ‘note-type’ and click Fields. We’ll rename the current front and backside as Expression and Meaning, and add three new ‘fields’ Audio, Examples and Notes (that one could be used for personal notes). Close this screen and click on Cards. We’ll manage the different cards this note generates as well as it’s make-up.

We’ll start with a basic layout. Add the following lines to the bottom of the middle Shared Style screen. For optimal learning, we’ll keep kana-readings as furigana displayed only touch/hover. This way learners are less likely to use them as a crutch.

ruby rt { visibility: hidden; }
ruby:hover rt { visibility: visible; }

Next, click the + button at the top of the screen twice to create two more card-templates. Rename (by clicking MoreRename) those templates (Card 1, Card 2 and Card 3) respectively as Recognition, Production, and Audio.

Finally, let’s wrap up our Anki set-up by creating the actual card’s templates. Each card will question you on one field (the Japanese expression, the English translation and the Audio) and show the answer on the backside along with audio and any potential notes, if present. Your card’s templates should look as follows:

Recognition

  • Front Template
<div lang="ja">{{furigana:Expression}}</div>
  • Back Template
{{FrontSide}}

<hr id=answer>

{{furigana:Meaning}}<br/>

{{#Notes}}
<br/>
<b>Notes:</b>
<br>{{furigana:Notes}}
{{/Notes}}

{{Audio}}<br/>

Production

  • Front Template
{{furigana:Meaning}}<br/>
  • Back Template
{{FrontSide}}

<hr id=answer>

{{furigana:Expression}}
<br>
{{Audio}}

{{#Notes}}
<br><br>
<b>Notes:</b>
<br>{{furigana:Notes}}
{{/Notes}}

Audio

  • Front Template
Listen.</br>{{Audio}}
  • Back Template
{{FrontSide}}

<hr id=answer>

<div lang="ja">{{furigana:Expression}}</div><br/>

{{furigana:Meaning}}<br/>

{{#Notes}}
<br><br>
<b>Notes:</b>
<br>{{furigana:Notes}}
{{/Notes}}

Mapping

When you’re finished, don’t close Anki just yet. Our final step for now is to map our Firefox or Chrome Yomichan settings to Anki so our generated cards are using the correct card-template and saved to the correct set. In the Yomichan options screen scroll down to the ‘Anki Options’ category and change accordingly: Deck → Yomichan, Model → yomichan Field Expression → {furigana-plain}, Meaning → {glossary-brief}, Audio → {audio}.

Testing

Now let’s try out our new set-up!

(Anki has to remain open whenever we vocab-mine using Yomichan, so just keep Anki opened in the background for now.)

Press and hold shift or your middle-mouse-button and hover over the words below. A yomichan pop-up should appear.

()みちゃん | 暗記(あんき) (I’m not obsessed, I swear~)

Just press the green Add Expression icon on the pop-up or use the key short-cut Alt-E to import these words into your set.

(I’ll add my copy soon, promise)

I've exported my own copy of this example and uploaded if you want to compare or save yourself the work of creating the note template manually:

* **Download**: [Example set Yomichan <i class="icon-download-alt"></i>](https://www.dropbox.com/s/xnj67hqj3cubfn2/Yomichan%20vocab.apkg?dl=0)

Japanese Example Sentences

Our current set-up is pretty useful already, but as seen in the GIF at the top of the page, some further effort will allow us to add proper example sentences and their translations to our mined vocabulary on-the-fly.

We’ll use an existing Anki add-on called Japanese Example Sentences to add Japanese sentences taken from Tatoeba.org, a “collaborative, open, free and even addictive” community on producing example sentences (the Internet is can at times be a wonderful environment).

Download

The Japanese Example Sentences add-on has a page on Ankiweb’s plug-in page, but as usual we’ll install the plug-in using the Desktop Anki application. Go to ToolsAdd-onsBrowse & Install, and copy-paste 2413435972 in the pop-up dialog. Restart the application to complete the installation.

This example-set is fairly outdated. Follow the instructions left in the plug-in comment section to update to the most recent set.

Set-up

In its current stage, this plug-in can contextualizing existing cards using EditBulk-add examples . There are two requirements so-far: the ‘note-type’ should have both an examples field and expression field, and the expression should be just the Japanese expression without square brackets containing furigana. If those requirements are met, we can contextualize existing cards using EditBulk-add examples from the card-browser, or contextualize new cards when creating a new card of a note-type that contains the examples and expression fields.

However, we do have square brackets containing furigana in our expression fields, and contextualizing cards generated using Yomichan is not yet possible. Finally, we want to alter out cards’ lay-out to display our example sentences in a responsible fashion. We’ll need some further edits.

Card Lay-out

Add the code below to the bottom of the middle lay-out screen. It’ll display the example sentences to the left of your cards.

.examples {font-size:75%; text-align: left;}
.title {font-size:16px; color: #999999;}
  • Back Template

Add the HTML code below to the bottom of your different cards’ back templates.

{{#Examples}}
<br/>
<div class="examples" lang="ja">
<span class= "title">Sentences:</span><br/>
{{furigana:Examples}}
</div>
{{/Examples}}

center border

Usage with Yomichan / Anki-Connect

For proper integration with Yomichan, I’ve made some adjustments to both its Anki-Connect add-on and the Japanese_Examples add-on. I’ve added the edited files on a new repository on my github so go ahead and replace the existing add-on files on your Anki’s add-on folder on your computer (eg. C:\Users\USER_NAME\Documents\Anki\addons or C:\Users\USER_NAME\AppData\Roaming\Anki2\addons) with the ones on there. I’ve described all my edits below in case you’d prefer to do this manually. Feel free to skip this part if you’re not technically inclined.

japanese_examples.py

We’ve set up our notes to show furigana on our vocabulary. This requires square brackets (eg. 気象庁[きしょうちょう]). The Anki plug-in for Japanese examples however does not support this out of the box. For that reason, I’ve added a regular expression to only use the contents up to the first square bracket as expression.

searched = re.search(r'^[^\[]+',expression)
if searched:
    expression = searched.group(0)

If you’d like to edit this yourself, add that piece of code to the find_examples class right after it defined examples as a list. it should be around line 139 (def find_examples(expression, maxitems): examples = []).

Secondly, I’ve edited the mark-up of the example sentences to hide the English translations unless hovered above (or on press on smart-phones).

Locate the examples.append call in the find_examples method. You’ll want to replace it (I commented it out) with the code below. It’ll be around line 174.

examples.append("<div id='eng_test'>%s<span id='eng_sentence'>%s</span></div>" % tuple(example.split('\t')))

In the find_examples_multiple method (around line 214), replace the current return with the line below. We’ll want just one break between example sentences.

return "<br>".join(examples)

Anki-Connect.py

This extension calls on Anki’s API to create new notes. All my edit does is call japanese_examples at run-time.

First, we’ll have to import the japanese_examples extension to be able to call its methods. If you’re doing this set-up manually, add the line below near the top, along with the other includes (around line 30).

from japanese_examples import *

Next, I’ve written a few lines in the addNote method to call Japanese-examples’ find method at run-time and, if examples were found and our note-type has the correct destination field, add these to our newly created card. This should come before collection = self.collection() around line 700.

# for use with Japanese examples
examples = find_examples_multiple(ankiNote, MAX_PERMANENT)

# if field is empty and examples exist
if examples and not ankiNote[DEST_FIELD]:
    ankiNote[DEST_FIELD] = examples

DEST_FIELD is a global variable defined in japanese_examples.py. If Anki gives an error, there might be a mismatch in naming. Check the naming in japanese_examples.py and change DEST_FIELD accordingly.


Important! For this to work, you’ll need to make an edit in your note template’s layout. As usual enter the note-type management screen by pressing CTRL-SHIFT-N, or click ToolsManage Note Types. Select the note-type of the cards you’d like to contain example sentences and click fields. From there, select the Yomichan note, click cards and add the following CSS-code to the bottom of the shared lay-out screen in the middle.

#eng_sentence { display: none; }
#eng_test:hover #eng_sentence{ display: inherit; color: #eb4c42;}

Usage

Contextualizing existing cards

If you’ve set up Yomichan to include ‘yomichan’ as tag on new cards, this should be a breeze. Open Anki’s card-browser (by clicking Browse or pressing b), select the yomichan tag in the left column, and press ctrl-a to select all your cards. Next, click EditBulk-add examples.

Contextualizing imported cards

If you’ve followed above steps, every time you add a new word on-line, it’ll automatically contain example sentences as well.

Try it out on our next “Words of the Day“™!

文脈(ぶんみゃく) | 語彙(ごい)

Example Set

COMING SOON!

As usual, I've exported my own copy of this tutorial and uploaded it in case you'd like to compare or save yourself the work of editing the note template yourself.

* **Download**: [Example set Sentences <i class="icon-download-alt"></i>](https://www.dropbox.com/s/2lq0d7cn2rqywih/Rikai%20vocab_context.apkg?dl=0)

Sanseido Japanese Definitions

Note: if you’re using Anki 2.1+, this feature is unsupported yet.

Support for on-line monolingual dictionary definitions is a feature often requested of Yomichan. Right now, Japanese EPWING dictionaries are supported out-of-box, but these are propriety software and not easy to get a hold of. The author has however expressed some reluctance to adding support for such on-line dictionaries due the instable nature of accessing definitions: through web-scraping. The slightest update to the structure of an on-line dictionary would render the feature unusable.

That said, I’ve being doing exactly that, automatically web-scraping Japanese dictionary Sanseido when vocab-mining with Rikaisama / Yomichan, for the past three years without any issues. This part of my post will guide you through setting this up; technically it’s incredibly similar to the Example Sentences sub-guide, so if you’ve come this far it should be a breeze. The result of our work will look as follows:

center border

Download

Again we’ll use an existing Anki add-on: Sanseido Definitions. As usual we’ll install the plug-in using the Desktop Anki application. Go to ToolsAdd-onsBrowse & Install, and copy-paste 1967553085 in the pop-up dialog. Restart the application to complete the installation.

Set-up

The ‘note-types’ of the vocabulary you want Japanese definitions for will need a new field to contain the definition. On the desktop Anki application, press CTRL-SHIFT-N, or click ToolsManage Note Types, to enter the ‘note-type’ management screen. Select the ‘note-type’ of the cards you’d like to contain example sentences and click fields.

center border

On the next screen, click add and call the field Sanseido. Now close this screen. On the previous ‘note-type’ management screen, click cards. We’ll edit our lay-out and display the new field in our cards.

Anki Note Lay-out

Lay-out

Add the following CSS code to the shared style screen of your note’s ‘card-type’ template.

.title {font-size:16px; color: #999999;}

Templates

Add the following code below the line displaying your vocab expression’s definition (eg. {{Meaning}}) . You’ll do this in ExpressionBack Template, MeaningFront Template and AudioBack Template.

<br/>{{#Sanseido}}
<br/><div id="japanese_meaning">
<span class= "title">Japanese:</span><br/> 
<span id= "japanese" class="sanseido">
{{furigana:Sanseido}}<br/><br>
</span></div>
{{/Sanseido}}

Bulk-edit

Open Anki’s browser (by pressing b or clicking Browse from the main window). The left of this browser has an overview of all your different sets and tags. Select the deck or tag containing the cards you’d like to edit. Press ctrl-a to select all of those and click EditRegenerate Sanseido Expression. It will crawl the Internet for each new definition so this might take quite a while.1

center border

Note: the plug-in expects your vocabulary to be contained in a field called Word. If your field is called Expression, you’ll have to edit this in the plug-in’s python file on your Anki’s add-on folder (eg. C:\Users\YOUR_USERERNAME\Documents\Anki\addons\sanseidoDefsForAnki.py). Open it with your text-editor of choice and change expressionField = 'Word' to expressionField = 'Expression'.

Finally, as of July 2017, Sanseido’s domain-name changed from .net to .biz. You’ll have to manually edit sanseidoDefsForAnki.py again; just search for sanseido.net (ctrl-f) and replace it with sanseido.biz. Alternatively, replace the file with the one on my github repository linked below.

Usage with Yomichan / Anki-Connect

As with the section on example sentences, a drawback to this plug-in when used in combination with our set-up is that it does not support vocabulary formatted to use furigana, and neither can Japanese definitions be added automatically on adding new cards with Yomichan. We’ll have to make some further adjustments.

I’ve added the edited files on a new repository on my github so go ahead and replace the existing add-on files on your Anki’s add-on folder on your computer (eg. C:\Users\YOUR_NAME\Documents\Anki\addons) with the ones on there. I’ve described all my edits below in case you’d prefer to do this manually. Feel free to skip this part if you’re not technically inclined.

sanseidoDefsForAnki.py

We’ve set up our notes to show furigana on our vocabulary. This requires square brackets (eg. 気象庁[きしょうちょう]). The Anki plug-in for Sanseido definitions however does not support this out of the box. For that reason, I’ve added a single line of code that uses a regular expression to only use the contents up to the first square bracket as expression.

term = re.search(r'^[^\[]+',term).group(0)

If you’d like to edit this yourself, add the following code as first line in the fetchDef class - it should be around line 27 (def fetchDef(term):).

Anki-Connect.py

Again, Anki-Connect will run sanseidoDefsForAnki at the point of creating new cards. First, we’ll have to import that extension to be able to call it’s methods. If you’re doing this set-up manually, add the following line near the top, with the other includes (around line 30).

from sanseidoDefsForAnki import *

Next, I’ve written a few lines in the addNote method to call sanseidoDefsForAnki’s glossNote method at run-time and, if examples were found and our ‘note-type’ has the correct destination field, add these to our new card. Again this should come before collection = self.collection() around line 700.

# Create sanseido definitions
try: glossNote( ankiNote )
except Exception as e:
    QMessageBox.critical(self.window(), 'AnkiConnect', 'Error, could not create sanseido definition.')
    raise e
try: ankiNote.flush()
except Exception as e:
    QMessageBox.critical(self.window(), 'AnkiConnect', 'Error, could not create sanseido definition.')
    raise e

Imported cards

If you’ve followed above steps, every time you add a new word with Yomichan, it’ll automatically contain a Sanseido dictionary definition as well.

Try it out on our next “Words of the Day“™!

逆転(ぎゃくてん) | 裁判(さいばん)

Download Example Set

As usual, I’ve exported my own Anki copy of this tutorial and uploaded it in case you’d like to compare or save yourself the work of editing the note template yourself. This one follow up on the last parts of the guide and is identical to the template I’m using myself.

COMING SOON

* **Download**: [Example set Sanseido <i class="icon-download-alt"></i>](https://www.dropbox.com/s/9wrpciaawfxeuo5/Rikai%20vocab_jj.apkg?dl=0)

Applications

I’ve covered several ways of using these tools back in 2016. Rikaisama and Yomichan cover any format that displays actual Japanese text on your browser. This goes from reading news-articles, social media or HTML-formatted novels (I personally use this method to read Kindle-bought literature), but also HTML5 video-games, or viewing anime on Animelon’s multi-layer subtitled streaming web-app (no affiliation, its free and I just think it’s a pretty cool service).

Rikaisama

Rikaisama is dead, long live Rikaisama!

While Firefox broke support of (unsigned) XUL-based add-ons and thus Rikaisama, further usage is still possible through XUL-supporting Firefox-derivatives such as Waterfox, Pale Moon and Basilisk.

For day-to-day practices, installing an additional browser seems like an unnecessary bloated approach, but despite its wonderful successor, I’m still quite partial to Rikaisama solely for reading longer texts such as Japanese novels,2 since Rikaisama’s one-button solution to importing cards into Anki is frankly just more time-efficient as Yomichan. Finally, if you’ve already painstakingly gone through my previous tutorials, this method will require the least amount of additional effort.

Set-up

All this step requires is downloading one of those Firefox-derivatives and following my prior guides (I’ve gone through them again while setting up Waterfox and they’re still applicable).3 Personally, I use Yomichan with Chrome on a day-to-day basis, and Rikaisama in combination with Waterfox while reading large texts.

As for the previous guides on Rikaisama, I’ve added links in the next section

Wait! There is more!

Although I’ve extensively covered Anki/browser-integration in my 2016 blog series, Rikaisama’s status as legacy software rendered some of my previous writings rather obsolete and it was thus high time for an update. While I’m still keen on Rikaisama using Firefox-alternative Waterfox in certain situations (namely, handling large texts such as novels), I’ve switched to using Yomichan in day-to-day situations. Along with this new post, I’ve slightly updated my previous posts and still recommend them to the completionist. If you’ve any further questions, feel free to check out the other articles in this series on Anki, or to leave a comment below.


  1. Image taken from the 2012 Japanese animated film Wolf Children by Mamoru Hosoda, used under Fair Use doctrine. 

  2. Granted, the off-line Yomichan-application that predated the current Yomichan Chrome plug-in covered most of these bases, but in my opinion reading novels on Yomichan was less as ideal and the project has been rendered obsolete since development of the Chrome plug-in took off. 

  3. It must be said that there’s benefits and downfalls to each of those derivatives and I don’t specifically recommend you to replace your current browser with one of these unless you know what you’re doing.  

  4. If you’re relatively new to the application, I recommend my 2016 post A Quick Guide on Using Anki (effectively) (in an academic context). Although visually bare-bones, Anki has vast possibilities and is extremely