Jump to content
Chinese-Forums
  • Sign Up

Anki Hanzi statistics plugin


Hedge

Recommended Posts

  • 3 weeks later...

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?

Link to comment
Share on other sites

  • 1 year later...

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

Link to comment
Share on other sites

  • 3 weeks later...
  • 2 months later...
  • 1 year later...

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
Link to comment
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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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...