hakka-dict-toolkit
v0.2.0
Published
A toolkit for https://hakka.dict.edu.tw/hakkadict/index.htm
Downloads
4
Readme
hakka-dict-toolkit
A toolkit for Taiwan Hakka Dictionary.
Installation
yarn add hakka-dict-toolkit
or
npm install hakka-dict-toolkit --save
Usage
Overview
var hakka = require('hakka-dict-toolkit')
// search query
hakka.search('客')
// access entry via index
hakka.entry(10377)
// appendix in the entry 10377
hakka.appendix('03002-001', 3)
hakka.search(query, [options])
: search entrieshakka.entry(index, [options])
: access to the entryhakka.appendix(indicator, type, [options])
: access to the appendix
hakka.search(query, [options])
Search entries with a query and returns a promise with list of Entry.Item.
hakka.entry(index, [options])
Provide access to the appendix of MOE Hakka Dictionary by index and returns a promise with either a format of word or character's.
Return Format (word)
{
title : string,
sounds : Entry.MainSound[],
another : Entry.ItemSound[],
meaning : string,
mandarin : string,
pos : string[],
variant : string,
synonym : Entry.Item[],
antonym : Entry.Item[]
}
title
: title of the entrysounds
: pronounciations in 6 main Hakka dialects in Taiwan. See Entry.MainSound.another
: other pronounciations, including Vun-pag accents (文白讀). See Entry.ItemSound.meaning
: definition of the entrymandarin
: gloss in Mandarinpos
: part of speechesvariant
: a link to a table containing variant written forms form other referencessynonym
: list of synonyms. See Entry.Item.antonym
: similar as above
Return Format (character)
{
title : string,
sounds : Entry.MainSound[],
another : Entry.ItemSound[],
meaning : string,
mandarin : string
radical : string,
stroke : number[]
}
radical
: an important component of Sinitic character to look up (部首)stroke
: two numbers indicating stroke count of Sinitic character excluding radical and including radical, respectively
hakka.appendix(indicator, type, [options])
Provide access to the entry of MOE Hakka Dictionary by indicator and dialect type, and returns a promise with list of Entry.AppSound. Dialect type is the following:
1
: Xi-Ien dialect (四縣腔)2
: Hoi-Liug dialect (海陸腔)3
: Tai-Bu dialect (大埔腔)4
: Ngiau-Pin dialect (饒平腔)5
: Zhio-On dialect (詔安腔)6
: Nam-Xi-Ian dialect (南四縣)
See Hakka Dialects.
Options
verbose (boolean)
Default value is true
. If the flag is set to be false
, the return values will turn to be:
hakka.search
: list of Proto.Itemhakka.entry
: Proto.Char or Proto.Wordhakka.appendix
: list of Proto.AppSound
Other Formats
Entry.MainSound
{
type : string,
phonetic : string,
vunpag? : string,
media : string
}
type
: type of dialect, see Hakka Dialectsphonetic
: spelled by Hakka-ngi Phin-Yim Fong-On, see Romanisationvunpag
: either'文讀'
or'白讀'
, see Literary Readings and Colloquial Readingsmedia
: an uri to the sound of pronounciation
Entry.ItemSound
{
type : string,
phonetic : string,
vunpag? : string,
link? : string
}
type
,phonetic
,vunpag
: see Entry.MainSoundlink
: an uri to another entry
Entry.AppSound
{
type : string,
phonetic : string,
vunpag? : string,
text? : string,
media? : string
}
type
,phonetic
,vunpag
,media
: see Entry.MainSoundtext
: title of the appendix
Entry.Item
{
text : string;
link? : string;
}
link
: an uri to entry
Proto.Word
{
title : string,
type : string,
index : number,
index_ap : string,
sounds : Proto.MainSound[],
another : Proto.ItemSound[],
related : { type : number }[],
meaning : string,
mandarin : string,
pos : string[],
variant : boolean,
synonym : Proto.Item[],
antonym : Proto.Item[]
}
title
: title of the entrytype
:word
, indicating the type of return valuesounds
: pronounciations in 6 main Hakka dialects in Taiwan. See Proto.MainSound.another
: other pronounciations, including Vun-pag accents (文白讀). See Proto.ItemSound.meaning
: definition of the entrymandarin
: gloss in Mandarinpos
: part of speechesvariant
: indicate whether the entry exists the link about variant written formsynonym
: list of synonyms. See Proto.Item.antonym
: similar as above
Proto.Char
{
title : string,
type : string,
index : number,
index_ap : string,
sounds : Proto.MainSound[],
another : Proto.ItemSound[],
related : { type : number }[],
meaning : string,
mandarin : string,
radical : string,
stroke : number[]
}
type
:character
, indicating the type of return valueradical
: an important component of Sinitic character to look up (部首)stroke
: two numbers indicating stroke count of Sinitic character excluding radical and including radical, respectively
Proto.MainSound
{
phonetic : string,
vunbag? : string,
type? : number,
hasmedia? : boolean
}
type
: type of dialect, see Hakka Dialectsphonetic
: spelled by Hakka-ngi Phin-Yim Fong-On, see Romanisationvunpag
: either'文讀'
or'白讀'
, see Literary Readings and Colloquial Readingshasmedia
: indicate whether it has media or not
Proto.ItemSound
{
phonetic : string,
vunbag? : string,
type? : number,
index? : number
}
phonetic
,vunbag
,type
: see Proto.MainSoundindex
: index to the entry
Proto.AppSound
{
phonetic : string,
vunbag? : string,
type? : number,
text? : string,
index? : number
}
phonetic
,vunbag
,type
: see Proto.MainSoundtext
: title of the appendixindex
: index about media
Proto.Item
{
text : string,
index? : number
}
text
: title of the entryindex
: index to the entry
Misc
Romanisation
The romanisation is called Hakka-ngi Phin-Yim Fong-On (客家語拼音方案), published by MOE in Taiwan in 2012.
Literary Readings and Colloquial Readings (文白異讀)
A relative notation between distinct reading forms to the identical character, called Literary Reading (Vun-tug, 文讀) and Colloquial Reading (Pag-tug, 白讀), is mainly used in languages in Sinitic family. Generally, tag '文讀'
indicates the reading form is used in formal situation or is later introduced in the phonological system, whereas tag '白讀'
often indicates the reading form is used in informal situation or is former introduced or original in the phonological system.
For example, character 生 (life, fresh, raw, unacquaintance), in Xi-Ien Hakka, has two reading forms: literary reading sen24 (sɛn˨˦) and colloquial form sang24 (saŋ˨˦).
Hakka Dialects
There are 6 main Hakka dialects recognized in Taiwan:
- Xi-Ien dialect (四縣腔)
- Hoi-Liug dialect (海陸腔)
- Tai-Bu dialect (大埔腔)
- Ngiau-Pin dialect (饒平腔)
- Zhio-On dialect (詔安腔)
- Nam-Xi-Ian dialect (南四縣)
License
MIT