diff options
author | lonkaars <loek@pipeframe.xyz> | 2023-07-12 00:31:12 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2023-07-12 00:31:12 +0200 |
commit | 413501fde6bac909f31ad399781626caa16c8d04 (patch) | |
tree | 7514b0f551a7c41f618d58a50fa56972e6b06170 /examples | |
parent | e99ae80f7adc0f0e677381c3cc1549235d3877ab (diff) |
implement parser breaks
Diffstat (limited to 'examples')
-rw-r--r-- | examples/reading-correction-break.ts | 12 | ||||
-rw-r--r-- | examples/readme.md | 4 |
2 files changed, 8 insertions, 8 deletions
diff --git a/examples/reading-correction-break.ts b/examples/reading-correction-break.ts index 6761165..a72e545 100644 --- a/examples/reading-correction-break.ts +++ b/examples/reading-correction-break.ts @@ -1,23 +1,23 @@ import Yomikun from "../api/yomikun.ts"; import DirectCoreClient from "../core/direct/client.ts"; -// WIP - // Create a direct (local) API instance var api = new Yomikun(new DirectCoreClient()); // Explicitly wait until everything is ready (not required) await api.ready; -// index sentence (generates wrong readings) -var sentence = await api.sentence("日本に来て一番驚いたことは自動販売機の多さだ。"); +// index sentence (generates wrong reading for 「この辺に」) +var sentence = await api.sentence("やっぱりこの辺にある武器も朽ちてるみたいだし"); // generated reading (wrong) console.log(sentence.furigana()); -// insert parser break -sentence.break(sentence.at("漢字")); +// insert parser break in the middle of a (wrong) expression +await sentence.break(sentence.at("この辺") + 2); // generated reading (correct) console.log(sentence.furigana()); +// TODO: this is a bad example, find an example that uses adjacent kanji that +// can become a larger compound, but should be two separate words. diff --git a/examples/readme.md b/examples/readme.md index bc7fa9d..707a034 100644 --- a/examples/readme.md +++ b/examples/readme.md @@ -8,8 +8,8 @@ using the Yomikun API.~ Examples (checked = working): - [ ] Lookup a word in a sentence -- [ ] Get furigana in HTML for a sentence -- [ ] Correct the reading of a word (because of ambiguous word boundries) by inserting a break +- [x] Get furigana in HTML for a sentence +- [x] Correct the reading of a word (because of ambiguous word boundries) by inserting a break - [ ] Login as a regular user and ignore an expression - [ ] Login as root and import a dictionary from a local file - [ ] Series-specific search with a lot of jargon |