Api
Dictionary + tokenizer API helpers.
Functions¶
apiByRadicals()¶
Defined in: src/shared/dict/api.ts:206
Finds kanji by their radical components.
Parameters¶
| Parameter | Type | Default value | Description |
|---|---|---|---|
radicals |
string[] |
undefined |
The radical glyphs. |
mode? |
"all" | "any" |
"all" |
Whether a kanji must contain every picked radical or at least one of them. |
Returns¶
The matching kanji.
apiDictQuery()¶
Defined in: src/shared/dict/api.ts:63
Looks up dictionary data for a word or wildcard pattern. Optional token hints (reading + part of speech, from tokenization) rank matching entries first and let unknown written forms fall back to a lookup by reading.
Parameters¶
| Parameter | Type | Default value | Description |
|---|---|---|---|
word |
string |
undefined |
The word or wildcard pattern. |
wildcard? |
boolean |
false |
Treat word as a wildcard pattern. |
hints? |
{ pos?: string; reading?: string; } |
undefined |
Token hints, when known. |
hints.pos? |
string |
undefined |
- |
hints.reading? |
string |
undefined |
- |
Returns¶
The lookup result.
apiKanji()¶
Defined in: src/shared/dict/api.ts:96
Fetches the full profile of a single kanji.
Parameters¶
| Parameter | Type | Description |
|---|---|---|
literal |
string |
The kanji character. |
Returns¶
The kanji profile.
apiKanjiAudio()¶
Defined in: src/shared/dict/api.ts:122
Lists the pronunciation clips available for a kanji (Kanji Alive).
Parameters¶
| Parameter | Type | Description |
|---|---|---|
literal |
string |
The kanji character. |
Returns¶
The clip listing (empty without the audio pack).
apiKanjiSentences()¶
Defined in: src/shared/dict/api.ts:161
Lists example sentences that contain a kanji.
Parameters¶
| Parameter | Type | Default value | Description |
|---|---|---|---|
literal |
string |
undefined |
The kanji character. |
limit? |
number |
10 |
Maximum sentences to return. |
Returns¶
The matching sentences with translations.
apiKanjiStrokes()¶
Defined in: src/shared/dict/api.ts:108
Fetches a kanji's stroke-order diagram as an inline-able SVG document
(KanjiVG). Rejects with a 404 ApiError when no stroke data exists.
Parameters¶
| Parameter | Type | Description |
|---|---|---|
literal |
string |
The kanji character. |
Returns¶
Promise\<string>
The SVG markup.
apiKanjiWords()¶
Defined in: src/shared/dict/api.ts:149
Lists dictionary entries whose written form uses a kanji.
Parameters¶
| Parameter | Type | Default value | Description |
|---|---|---|---|
literal |
string |
undefined |
The kanji character. |
limit? |
number |
50 |
Maximum entries to return. |
Returns¶
The matching entries.
apiRadicals()¶
Defined in: src/shared/dict/api.ts:194
Lists every search radical with its stroke count (RADKFILE).
Returns¶
Promise\<RadicalInfo[]>
All search radicals.
apiResolveRef()¶
Defined in: src/shared/dict/api.ts:184
Resolves a sense cross-reference or antonym code into its entries.
Parameters¶
| Parameter | Type | Description |
|---|---|---|
ref |
string |
The reference code from a sense's xrefs/antonyms. |
Returns¶
The referenced entries.
apiSearchEnglish()¶
Defined in: src/shared/dict/api.ts:173
Searches dictionary entries by English meaning (reverse lookup).
Parameters¶
| Parameter | Type | Default value | Description |
|---|---|---|---|
q |
string |
undefined |
The English search text. |
limit? |
number |
50 |
Maximum entries to return. |
Returns¶
The matching entries.
apiTokenize()¶
Defined in: src/shared/dict/api.ts:25
Tokenizes a sentence on the server, returning one stitched JapaneseWord per
word (no dictionary data).
Parameters¶
| Parameter | Type | Default value | Description |
|---|---|---|---|
sentence |
string |
undefined |
The Japanese sentence. |
mode? |
BundleMode |
"grammar" |
How aggressively to group tokens. |
Returns¶
Promise\<JapaneseWord[]>
The stitched words.
apiTokenizeBatch()¶
Defined in: src/shared/dict/api.ts:43
Tokenizes many sentences in one request (used to pre-tokenize a whole subtitle file).
Parameters¶
| Parameter | Type | Default value | Description |
|---|---|---|---|
sentences |
string[] |
undefined |
The sentences, in order. |
mode? |
BundleMode |
"grammar" |
How aggressively to group tokens. |
Returns¶
Promise\<JapaneseWord[][]>
One word list per input sentence.
dictAudioClipUrl()¶
Defined in: src/shared/dict/api.ts:137
Builds the playable URL of one pronunciation clip, for use as an
<audio> source (the dictionary endpoints are not profile-scoped).
Parameters¶
| Parameter | Type | Description |
|---|---|---|
literal |
string |
The kanji character the clip belongs to. |
clip |
string |
The clip id from apiKanjiAudio. |
Returns¶
string
The clip URL.
isEmptyDict()¶
Defined in: src/shared/dict/api.ts:80
Whether a dictionary lookup found nothing (every result list empty).
Parameters¶
| Parameter | Type | Description |
|---|---|---|
data |
KotobaseData |
The lookup result. |
Returns¶
boolean
true when empty.