0.2.0 • Published 6 years ago

hakka-dict-toolkit v0.2.0

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

hakka-dict-toolkit

NPM version Open Source Love

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 entries
  • hakka.entry(index, [options]): access to the entry
  • hakka.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 entry
  • sounds: 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 entry
  • mandarin: gloss in Mandarin
  • pos: part of speeches
  • variant: a link to a table containing variant written forms form other references
  • synonym: 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:

Other Formats

Entry.MainSound

{
  type     : string,
  phonetic : string,
  vunpag?  : string,
  media    : string
}

Entry.ItemSound

{
  type     : string,
  phonetic : string,
  vunpag?  : string,
  link?    : string
}

Entry.AppSound

{
  type     : string,
  phonetic : string,
  vunpag?  : string,
  text?    : string,
  media?   : string
}
  • type, phonetic, vunpag, media: see Entry.MainSound
  • text: 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 entry
  • type: word, indicating the type of return value
  • sounds: 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 entry
  • mandarin: gloss in Mandarin
  • pos: part of speeches
  • variant: indicate whether the entry exists the link about variant written form
  • synonym: 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 value
  • 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

Proto.MainSound

{
  phonetic  : string,
  vunbag?   : string,
  type?     : number,
  hasmedia? : boolean
}

Proto.ItemSound

{
  phonetic : string,
  vunbag?  : string,
  type?    : number,
  index?   : number
}

Proto.AppSound

{
  phonetic : string,
  vunbag?  : string,
  type?    : number,
  text?    : string,
  index?   : number
}
  • phonetic, vunbag, type: see Proto.MainSound
  • text: title of the appendix
  • index: index about media

Proto.Item

{
  text   : string,
  index? : number
}
  • text: title of the entry
  • index: 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:

  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 (南四縣)

License

MIT