Jump to content
Chinese-forums.com
Learn Chinese in China

  • Why you should look around

    Since 2003, Chinese-forums.com has been helping people learn Chinese faster and get to China sooner. Our members can recommend beginner textbooks, help you out with obscure classical vocabulary, and tell you where to get the best street food in Xi'an. And we're friendly about it too. 

    Have a look at what's going on, or search for something specific. We hope you'll join us. 
Hedge

Anki Hanzi statistics plugin

Recommended Posts

Hedge

Hey,

I always wanted something similar to the Kanji statistics function in Anki, but for Hanzi, so I made a plugin.

More info here.

If anyone has any comments or suggestions, please tell me:)

Share this post


Link to post
Share on other sites
Site Sponsors:
Pleco for iPhone / Android iPhone & Android Chinese dictionary: camera & hand- writing input, flashcards, audio.
Study Chinese in Kunming 1-1 classes, qualified teachers and unique teaching methods in the Spring City.
Learn Chinese Characters Learn 2289 Chinese Characters in 90 Days with a Unique Flash Card System.
Hacking Chinese Tips and strategies for how to learn Chinese more efficiently
Popup Chinese Translator Understand Chinese inside any Windows application, website or PDF.
Chinese Grammar Wiki All Chinese grammar, organised by level, all in one place.

doviende

I love the latest version of this plugin (0.5 currently). The ability to not look at "New" cards is perfect for me, since i imported a ton of new cards lately and the count was off. works great :)

Share this post


Link to post
Share on other sites
HerrPetersen

Not much to add... Great tool. One question however: My deck contains of different models. When adding the "MyHanzi"-tag to two different models it seems the hanzistatistics only counts one of the two. Any ideas?

Share this post


Link to post
Share on other sites
doviende

you have to add the tag to a specific field within that model, not in the top-level model itself. At least, this was the mistake i made initially.

Share this post


Link to post
Share on other sites
jonlondon

Hi Folks,

I have just set myself up with Anki, using the Pinyin Toolkit & Hanzi Statistics plugins.

It's all working great for the decks I have made for myself, as well as two I downloaded.

My question though is, does anyone know if you can get the Hanzi Stats plugin to check for characters seen in multiple decks?

Would be very grateful for a bit of help.

Jonathan

Share this post


Link to post
Share on other sites
kdavid

Anyone having problems downloading this from the site? I'm getting a super-slow download speed for a few minutes and then it times out.

I know it's not a local issue because my utorrent is downloading at over 300 kbps.

Share this post


Link to post
Share on other sites
Korakow

How is this plugin supposed to work? Although I have a lot of Hanzi in my deck, the plugin says that "This deck contains 0 unique Hanzi."

Share this post


Link to post
Share on other sites
Gymnosopher

I initially had the same problem as above (Anki Hanzi Stats showing deck to contain 0 unique) but just managed to fix it. As this doesn't seem to be up anywhere else on the forum hopefully people will now be able to Hanzi Stats for Anki that may have had problems too.

Note: as both 'Hanzi Stats (Inofficial )' and 'Hanzi Stats (New HSK 2011)' work in the same way this fix can be done for either/both of them.

Basically, the plugin works by searching for Chinese characters in a specific field in your deck which it has set as 'Expression' by default. In order for the plugin to work then you will need to make sure these fields match - by either ensuring your Hanzi field is names 'Expression' or by editing the plugin file itself (actually easier than it might sound and doesn't interfere with how you manage your decks). For me this problem arose as I am using the Pinyin Toolkit and putting my Hanzi in a field called... Hanzi... So perhaps you've done the same or are using a downloaded deck which uses different fields which aren't picked up.

Below are step-by-step instructions on doing this - they may seem long but are really easy, I'm just trying to make this idiot proof (for when I forget how to do it :wink: )

Method #1 - Edit your deck (recommended if using several decks with differently named fields as the plugin looks for one named field; other plugins may also work with standard field names so changing these could make other non-working plugins work too)

1. Open the Deck you're interested in

2. Go to Settings > Deck Properties ...

3. Select the model that you have used for the Deck (i.e. the one that counts facts - on my current deck this is 'Mandarin [82 facts]' as I use the Pinyin Toolkit though you may have 'Basic [XXX facts]' or something similar) and click Edit

4. Select the card template that you have been using and click Card Layout at the bottom (again, the one that counts facts - so something like 'Recognition [82 facts]')

5. Go to the Fields tab via the top button and click on the field that holds the Hanzi in the deck (in my case this is Hanzi - if you're not sure which one is yours you can go right back to the first deck screen and look in the browser by clicking on the magnifying glass and reading the name of the field on the right of where the characters are)

6. Now change the name of this field in the textbox below to 'Expression' (which will change the name above at the same time)

7. Return to the Card Templates tab via the top button and change the field names in Question/Answer so they match the changes name in the Fields tab (for example, if the field was called 'Hanzi' and was changed to 'Expression' the Card Template would have displayed the field has {{Hanzi}} and need to be changed to {{Expression}})

8. That's it! Just hit Esc a few times to go back to the main screen. You should be able to view the statistics straight away by going to Tools > Hanzi Statistics - if you already had it open just run it again for it to work.

Method #2 - Edit the plugin (recommended if you have a way of naming your deck fields that is already unified across decks and you don't want to change, and also to be able to change other settings such as switching between simplified/traditional and reading from external files etc as outlined in the plugin itself)

1. Open the plugin folder straight from Anki by going to Settings > Plugins > Open Plugin Folder ...

2. Right click the Hanzi Stats .py file and click Open With ...

3. Select Notepad and click OK (other text editors should work too, notepad's just easy and less risky)

4. Scroll down until you see this:

####################################################################

# Return all unique Hanzi in the current deck. #

####################################################################

def get_deckHanzi():

hanzi_ids = mw.deck.s.column0("select id from fieldModels where name LIKE '%Expression%'")

5. Change '%Expression%' to match the name of the field you put Hanzi in when using Anki Decks (so in my case the field was called Hanzi and I changed this to '%Hanzi%' - if you don't know the name of the field you're using just check in the Anki deck Browser as outlined in method #1 step 5)

6. Save and Exit the file.

7. Close and restart Anki for the modified plugin to be reloaded and you're done!

Anyway, this is just something that hasn't worked for me for a while and I finally decided to see if it could work rather than just getting rid of the plugin. Now it works and looks great!

If anyone is still working on the Python coding I'd suggests it's probably beneficial to put in an 'or' option so the plugin would work with several field names such as Hanzi, Character, 中文, 汉字, Chinese, 词 etc as the Pinyin Toolkit does so that more people will be able to use it automatically without having to make the above revisions.

  • Like 2

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and select your username and password later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Click here to reply. Select text to quote.

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...