Anki Word Frequency Inserter: Learn most common words first

Apparently, it can be done natively with Yomichan, by adding a new template.

  • Enable Advanced Yomichan settings,

Advanced Yomichan settings

  • Configure Anki card templates…, at the bottom

  • Add a new template
{{#*inline "frequency-innocent"}}
    {{~#if (op ">" definition.frequencies.length 0)~}}
        {{~#each definition.frequencies~}}
            {{~#if (op "===" dictionary "Innocent Corpus")~}}
                {{frequency}}
            {{~/if~}}
            </li>
        {{~/each~}}
    {{~/if~}}
{{/inline}}
  • Configure Anki card format…, and type in {frequency-innocent} for where you want this data. (It doesn’t seem to appear in the dropdown.)
Actually, I have another edit for Pitch Accent.
{{#*inline "pitch-accent-list"}}
    {{~#if (op ">" pitchCount 0)~}}
        {{~#if (op ">" pitchCount 1)~}}<ruby lang = 'ja-JP'>ol<rp>(</rp><rt><span class='spoiler'>{~/if~</span></rt><rp>)</rp></ruby>}
        {{~#each pitches~}}
            {{~#each pitches~}}
                {{~#if (op ">" ../../pitchCount 1)~}}<ruby lang = 'ja-JP'>li<rp>(</rp><rt><span class='spoiler'>{~/if~</span></rt><rp>)</rp></ruby>}
                    {{~> pitch-accent-item-disambiguation~}}
                    {{~> pitch-accent-item format=../../format~}}
                {{~#if (op ">" ../../pitchCount 1)~}}<ruby lang = 'ja-JP'>/li<rp>(</rp><rt><span class='spoiler'>{~/if~</span></rt><rp>)</rp></ruby>}
            {{~/each~}}
        {{~/each~}}
        {{~#if (op ">" pitchCount 1)~}}<ruby lang = 'ja-JP'>/ol<rp>(</rp><rt><span class='spoiler'>{~/if~</span></rt><rp>)</rp></ruby>}
    {{~/if~}}
{{/inline}}

That is, else clause for “No pitch accent data” is deleted.


However, I am not sure if frequency can be added to existing Kanji cards as well?

2 Likes

Interesting, thanks for sharing! This looks useful for new cards.
Though if you already have many cards where the frequency field should be fixed, I don’t think you can batch-fix it with Yomichan (as you mentioned).

1 Like

I’m getting this error when trying to connect: (BCCWJ version offline)

Warning: ankiInserter.ankiSearchQuery doesn't include ankiInserter.ankiFrequencyFieldName.
You probably forgot to adjust the query or the frequency field name :)

Expression field and frequency are both correct. Any ideas?

EDIT: Okay, now it just miraculously started working without me changing anything :person_shrugging: Took a while to update 25k cards as well.

1 Like

Just added info that the BCCWJ version is the long unit version.
There’s also a short unit version (wasn’t available in JSON as linked by Kumi).

We could offer an option to choose one of two or even add both to separate fields in future, though the long unit version is already 5MB.

There seems to be some confusion as to what short and long unit/version mean, with conflicting information on whether short or long version means compound use (さん in 田中さん) or isolated use (さん), and whether short occurrences are still counted in the long version:

It’s weird because さん is more common in short unit, but 弁護 (compare 弁護士) is more common in long unit.

Would be very helpful if someone knows this precisely.
I added some links for research in that issue.


By the way, there’s also a working anime frequency version in progress, the html just needs a few changes.
Looks nice, because there are apparently some common words not found in BCCWJ: