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