diff options
Diffstat (limited to 'examples/user-ignore.ts')
-rw-r--r-- | examples/user-ignore.ts | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/examples/user-ignore.ts b/examples/user-ignore.ts index d0abbe3..f15baed 100644 --- a/examples/user-ignore.ts +++ b/examples/user-ignore.ts @@ -13,24 +13,26 @@ api.su("gert"); // Lookup sentence var sentence = await api.sentence("浮上したハイラル城の下にてゼルダ様達の捜索を行うこととなった"); +// Get reading for sentence +console.log(sentence.furigana()); + // Freeze disables automatic updating of words after database mutations. It's // used here because there are multiple sequential updates to the database. -sentence.freeze(); +await sentence.freeze(); // Ignore some expressions in JMdict (ignore applies to current user = gert in -// this case) -sentence.words.find(w => w.written("達") && w.read("だち"))?.ignore(); // wrong reading for this case -sentence.at("の下に").ignore(); // expression のもとに -sentence.at("下に").ignore(); // expression したに +// this case) (TODO: this only works on a fresh database) +await sentence.words.find(w => w.written("達") && w.read("だち"))?.ignore(); // wrong reading for this case +await sentence.at("の下に")?.ignore(); // expression のもとに +await sentence.forceUpdate(); // manual update to get last wrong term +await sentence.at("下に")?.ignore(); // expression したに // TODO: 達(だち) should not have to be ignored, but scored lower following // rendaku rules. <https://en.wikipedia.org/wiki/Rendaku> // Unfreeze allows updates again and implicitly calls .update() -sentence.unfreeze(); +await sentence.unfreeze(); // Get new reading for sentence -var furigana = sentence.furigana(); - -console.log(furigana); +console.log(sentence.furigana()); |