aboutsummaryrefslogtreecommitdiff
path: root/examples/reading-correction-break.ts
blob: 67611656971f87e9bbcd81a105dc69f91d8d22ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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("日本に来て一番驚いたことは自動販売機の多さだ。");

// generated reading (wrong)
console.log(sentence.furigana());

// insert parser break
sentence.break(sentence.at("漢字"));

// generated reading (correct)
console.log(sentence.furigana());