Thursday, August 26, 2010

A Modification of Rikaichan

How I use Anki

After my brief post on flashcards, I wanted to write about how I use Anki and a new tool that I've created to quickly grab vocab that I read on the web.

First, I'll take an example. I was reading this blogpost.

Let's take this sentence:

でも良い作品だとおもう。

and suppose that I don't know the word 作品. This is the information I want:

Word: 作品
Pronunciation: さくひん
Meaning: 製作したもの。
Sentence: でも良い___だと思う。
Gap: 作品
Source: URL to blog post

One of the best features of Anki is that it can take information like this and generate multiple cards. These are the cards that I have set up:


(click to see a larger version)

For the meaning, I tend to use a Japanese definition from an online dictionary because it captures the meaning well and is convenient. An English translation or a picture could also be used.

The source doesn't appear in the flashcards but I store it so I can go and see the context again if I need to.

The most important piece of information is the sentence. When I read it, I'm reminded of why it came up in the original material and it gives the vocab context. I know that I can use the vocab in this situation and the meaning of the word is clear in this context. If I encounter the word in a completely different context where it has a different meaning, I can add flashcards for this too.

You can add a model like this by going to Settings → Deck Properties and either edit one of the existing models or add a new one. You can then add fields for the word, the pronunciation etc. Click on the card templates tab to add the three cards I have. I suggest you look at existing models to get some ideas on how to format your cards. If there's demand, I can make a sample deck available so you can check out the model. [see update]

One big problem with flashcards is the time taken to create them. Am I wasting time creating flashcards, when I could be spending that time doing something else?

In order to solve this problem, I modified the popular extension called Rikaichan so that I could quickly pick up vocab that I read on the web.

Rikaichan

Rikaichan is an extension for the Firefox web browser. When you switch it on and hover your mouse cursor over a word, the pronunciation and meaning of the word will appear.


I have modified the extension such that when you have a word highlighted, you can press 's' to save customizable information to a text file. The information you can save is:

The highlighted word
The pronunciation of the word in hiragana
The dictionary lookup of that word (e.g. if the highlighted word is 行きます, this would be 行く)
The sentence the word appears in
The sentence the word appears in with a gap where the word is
English translation of the word from edict
The URL of the web page
A blank space

When you install rikaichan, a small smiley face will appear in the bottom right. You turn it on by clicking on this face. Move your cursor over words on the web page to see the popup.

By right clicking on the face, you can select options. You can choose which information you want to save by choosing the last tab in the options window. You can also choose where to save the text file.


Every time you press 's', your specified pieces of information will be saved to a new line in the text file. The different parts will be separated by tabs by default. You can also copy the data to the clipboard by pressing 'c'.

As you can see from the Anki model I described above, all of the information I need can be automatically saved, apart from the 'Meaning' part. For this part, I use a blank space, and I fill it in later if I need it. Surprisingly, the sentence by itself is often enough for me to remember the word.

At the end of every day at work, I save the text file and then import it into Anki by clicking File → Import...

This allows me to keep a steady stream of new vocab coming into my deck with a minimum of effort.

You can download the modified extension here.

To install, click the link and click 'Allow' when prompted. Alternatively, right click, save target as, then click File -> Open File and select the rikaichan-mod0_50.xpi file you downloaded. After that, you'll need to download the dictionaries here.

If you're using rikaichan already, delete the extension by clicking on Tools -> Add-ons then delete. No need to delete the dictionaries though.

This is a first release so there may be problems. I seriously doubt anything major will happen but I make no guarantees. Download at your own risk and all that.

The method used to fetch the sentence is very basic and I hope to improve it in the future. I've been using it for several weeks now. I use it a lot with Twitter. I chat with a lot of Japanese people and when they say words I don't understand, I click on the link to the tweet, turn on rikaichan, highlight the word and press 's'.

UPDATE: Due to demand in the comments, find a sample Anki deck here. This contains 9 cards for three words I picked up from reading the final blog post of Satoshi Kon.

UPDATE 21 April 2011: Firefox 4 broke the old add-on. Using the update to the original extension, I updated this one too. Here it is. If you have any problems, please leave a comment.

UPDATE 21 June 2011: Update to work with Firefox 5. No changes at all and haven't done much testing. Let me know if there are any problems. 

20 comments:

  1. Seemed to have gotten it working now after referring to your deck. I had to create a new model based on the order of the fields in the outputted text file. here is the order for anyone else wondering:

    Field 1 mapped to: Expression

    Field 2 mapped to: Reading

    Field 3 mapped to: Answer

    Field 4 mapped to: Full Example

    Field 5 mapped to: Example

    Field 6 mapped to: Meaning

    Field 7 mapped to: Example Source

    Field 8 mapped to: Tags (the blank space for now - this could be deleted)

    ReplyDelete
  2. The list I gave in the post was in no particular order. I was just saying "these are the things you can save to the text file".

    It's easy to configure the extension to change the ordering sent to the text file.

    You've got "Full example" and "example". What's the difference? Is "Full example" the sentence with a gap, and "example" the thing that goes in the gap?

    ReplyDelete
  3. Other way around. Full sentence was just my wording for the sentence without the gap. Example is with the gap.

    ReplyDelete
  4. This tweak sounds great! Thanks for sharing it.
    However I am already using a very nice addition to rikaichan that I would not like to give up :
    http://preview.tinyurl.com/rikaichan-audio
    Is there any chance that I might get both working simultaneously?

    ReplyDelete
  5. I was wondering if anyone was able to get this mod working on Firefox 4. I can't get it to work, but the add-on widget says it was cleared to work with the newest version of Firefox.

    ReplyDelete
  6. Yep, that's my fault. It needs to be amended to to work with FF 4. I'm very busy at the moment so won't have time to look at it for a while I'm afraid but I certainly intend to because I can't use it either at the moment. If anyone else wants to compare with the original rikaichan extension (which now works with FF4) and make the proper changes, they are very welcome to do so.

    Nice to hear that other people are using it though. :)

    ReplyDelete
  7. See the update above. It should be working now.

    ReplyDelete
  8. You're a lifesaver, sir. Manually copying and pasting passages, definitions, and everything was a major pain and was slowing me down terribly. Thanks a lot for updating the mod, and especially for doing it so quickly!

    ReplyDelete
  9. Any chance you could update the extension to work with the Firefox 5 beta?

    ReplyDelete
  10. Does the original rikaichan work with Firefox 5 beta? If so, I'll take a look. Otherwise, I'll wait and see what Jonathan does before I spend time getting it to work. With this new rapid release schedule, I hope they don't break compatibility every time...

    ReplyDelete
  11. I just checked, and thankfully it does. Any time you could spare to work on it would be pretty good. Honestly, I switched back from Chrome to Firefox just to try this extension of yours, so anything you'd have time for would be appreciated.

    ReplyDelete
  12. I'll try and take a look and I'll certainly try to get it done before the official release of FF 5.

    "try the extension"? If you haven't tried it, why not use FF 4 rather than a beta of the next release?

    I once looked at modifying rikaikun (the rikaichan equivalent for Chrome) in the same manner, but as far as I'm aware, it isn't possible. Extensions in Chrome aren't allowed save-to-file functionality.

    ReplyDelete
  13. I probably will. I guess I've always been a stickler for new betas and whatnot. :)

    ReplyDelete
  14. Posted an update for Firefox 5. Let me know if there are any problems.

    ReplyDelete
  15. Thanks a lot for this. It really helps me study Japanese. I used to write everything on a piece of paper. This is way better!

    ReplyDelete
  16. Wrightak I am trying to use your method on this website http://www.tanos.co.uk/jlpt/skills/vocab/sentences/
    It has a lot of examples for different words for different JLPT. When I hit 'S' button to save a word, I don't get the sentence saved. Everything else looks fine. Can you see what's going on?

    ReplyDelete
  17. What's probably happening is that the shortcut for another extension is interfering. I had this problem when using Echofon for Firefox. If both extensions use 's' as a hotkey, then conflicts will arise.

    Anyway, I'm no longer developing for this any more. The reason for this is that someone else looked at what I had done and incorporated it into their modification of rikaichan (without telling me). This guy's mod does everything mine does and more. I think he may have fixed a few of the bugs that were in mine too. He doesn't have a website (as far as I know) and is instead promoting it and discussing it on this forum:

    http://forum.koohii.com/viewtopic.php?pid=150067#p150067

    That links to the latest version at the time of writing this.

    ReplyDelete
  18. Actually 's' key was working but the plugin could not detect the sentence line. I disabled all plugins and installed the new mod the guy created. It all started because of your efforts. I  tried the new one and there are some cool features there. Thanks for sharing this and helping develop the plugin.

    ReplyDelete