From d2599f1efcbb7b30e1a4ab95e8e746d8da37cae0 Mon Sep 17 00:00:00 2001 From: Pacharapol Withayasakpunt Date: Wed, 27 Apr 2022 14:57:13 +0700 Subject: [PATCH] update README --- README.md | 17 +++++++++++++++++ docs/kanji/beyond.md | 6 ------ docs/kanji/wanikani.md | 4 ++++ scripts/get-kanji-level.ts | 8 ++++---- scripts/sort-anki.ts | 9 +++++++-- 5 files changed, 32 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index f64df1e..e315aee 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,18 @@ Extra contents beyond [WaniKani](https://www.wanikani.com). +## [Yomichan](https://foosoft.net/projects/yomichan/) or whatever custom vocab-to-Anki creator, card sorter + +This also sorts any vocabulary by WaniKani levels. I also have an old project of [Kanji beyond WaniKani](https://community.wanikani.com/t/fake-levels-61-70-or-%E7%84%A1%E9%99%90-infinity/16399). You can also use that (or opt not to). + +- Clone this repo +- Get `WANIKANI_API_KEY` from +- Install [Node.js](https://nodejs.org/en/), `npm i -g yarn`, `yarn` +- Confirm the constants in [`scripts/sort-anki.ts`](https://git.polv.cc/polv/wk-extra/src/branch/main/scripts/sort-anki.ts) +- Run `yarn ts scripts/sort-anki.ts` + +Note that [Kanji beyond WaniKani](https://community.wanikani.com/t/fake-levels-61-70-or-%E7%84%A1%E9%99%90-infinity/16399) **may be modified** or sorted in the future, depending on [Kanji with common components that aren’t Wanikani radicals](https://community.wanikani.com/t/x/56335) and my experience. + ## [Kanji with common components that aren’t Wanikani radicals](https://community.wanikani.com/t/x/56335) - [Wanikani Kanji that can serve as radicals](https://git.polv.cc/polv/wk-extra/src/branch/main/docs/kanji/radicalized-kanji.md) @@ -22,3 +34,8 @@ I also consider stepping into fonts' territory, if I deem that necessary; for ex - I will create a full website, if necessary to render "fonts". It is also possible that I will add Chinese contents (Hanzi) in the future. + +## Extras + +- Typed [AnkiConnect](https://foosoft.net/projects/anki-connect) can be found at [`src/ankiconnect.ts`](https://git.polv.cc/polv/wk-extra/src/branch/main/src/ankiconnect.ts) +- Typed [WaniKani API v2](https://www.wanikani.com/api/v2) can be found at [`src/wanikani.ts`](https://git.polv.cc/polv/wk-extra/src/branch/main/src/wanikani.ts) diff --git a/docs/kanji/beyond.md b/docs/kanji/beyond.md index 49cb449..0851b67 100644 --- a/docs/kanji/beyond.md +++ b/docs/kanji/beyond.md @@ -2,12 +2,6 @@ ## Joyo -### 脊 - -spine, Joyo, セキ - -[Stroke order and direction](https://jisho.org/search/%E8%84%8A%20%23kanji) for this, [in Chinese](https://www.mdbg.net/chinese/dictionary?page=worddict&wdrst=0&wdqb=%E8%84%8A), is a little different. - ## Newspaper ### 偲 diff --git a/docs/kanji/wanikani.md b/docs/kanji/wanikani.md index 332f689..55a3a86 100644 --- a/docs/kanji/wanikani.md +++ b/docs/kanji/wanikani.md @@ -19,6 +19,10 @@ ### 碑 +[55 - stature](https://www.wanikani.com/kanji/%E8%84%8A), セキ せ せい + +- [Stroke order and direction](https://jisho.org/search/%E8%84%8A%20%23kanji) for this, [in Chinese](https://www.mdbg.net/chinese/dictionary?page=worddict&wdrst=0&wdqb=%E8%84%8A), is a little different. + [56 - tombstone](https://www.wanikani.com/kanji/%E7%A2%91), ヒ いしぶみ - 碑文ひぶん diff --git a/scripts/get-kanji-level.ts b/scripts/get-kanji-level.ts index e7e2449..0d492b7 100644 --- a/scripts/get-kanji-level.ts +++ b/scripts/get-kanji-level.ts @@ -61,11 +61,11 @@ async function makeWaniKaniKanjiLevels(opts: { cache?: boolean } = {}) { return levelMap; } -export async function makeKanjiLevels() { +export async function makeKanjiLevels(opts: { useBeyond: boolean }) { const wk = await makeWaniKaniKanjiLevels({ cache: true }); - const beyond = yaml.load( - readFileSync('assets/beyond.yaml', 'utf-8'), - ) as ILevelMap; + const beyond = opts.useBeyond + ? (yaml.load(readFileSync('assets/beyond.yaml', 'utf-8')) as ILevelMap) + : {}; const kanjiToLevel = new Map< string, diff --git a/scripts/sort-anki.ts b/scripts/sort-anki.ts index d31ec28..97bbbb6 100644 --- a/scripts/sort-anki.ts +++ b/scripts/sort-anki.ts @@ -4,6 +4,12 @@ import { makeKanjiLevels } from './get-kanji-level'; const DECK = 'Takoboto'; const KANJI_FIELD = 'Japanese'; +/** + * Whether to use Level > 60, i.e. outside WaniKani + * + * @link https://community.wanikani.com/t/fake-levels-61-70-or-%E7%84%A1%E9%99%90-infinity/16399 + */ +const USE_BEYOND = true; async function main() { const anki = new AnkiConnect(); @@ -13,6 +19,7 @@ async function main() { }); const deckQuery = `deck:${DECK} -deck:${DECK}::*`; + const kanjiLevels = await makeKanjiLevels({ useBeyond: USE_BEYOND }); await anki .api('findCards', { @@ -20,8 +27,6 @@ async function main() { }) .then((cards) => anki.api('cardsInfo', { cards })) .then(async (rs) => { - const kanjiLevels = await makeKanjiLevels(); - const modelToSubdecks = new Map< string, {