Crate wordshk_tools[][src]

Expand description

A parser for words.hk (粵典)

Parses all entries marked with OK and store the results as a list of entries. This parser does not use any regular expressions, backtracking or other inefficient parsing techniques. It is powered by a library called lip that provides flexible parser combinators and supports friendly error messages.

A note on doc format: we generally put examples after a colon ‘:’.

Structs

A definition of a word

An example sentence in Mandarin, Cantonese, and/or English

An entry contains some information about a word.

A variant of a [word] with [prs] (pronounciations)

Enums

Language tags for alternative languages other than Cantonese and English

Two types of segments: text or link. See Segment

Functions

Parse a clause in an alternative language

Parse a Clause

Parse the content of an Entry

Parse a series of definitions for a word, separated by “----”

Parse the whole words.hk CSV database into a Dict

Parse an example for a word

Parse a multiline clause

Parse a Clause tagged in front by its name/category

Parse a partial pronunciation Clause, until the opening paren of Jyutping pronunciations

Parse a partial named pronunciation Clause, until the opening paren of Jyutping pronunciations

Parse a Jyutping pronunciation clause, for Cantonese (yue) and Mandarin (zho)

Parse a rich definition

Parse a simple definition

Parse tags on a word like pos, label, and sim

Convert a Dict to Apple Dictionary XML format

Type Definitions

A clause in an alternative language other than Cantonese and English

A clause consists of one or more Lines. Appears in explanations and example sentences

A dictionary is a list of entries

A line consists of one or more Segments

An example sentence with optional Jyutping pronunciation

A segment can be a text or a link