Documentation ¶
Overview ¶
Chinese-English dictionary database search functions
Chinese-English dictionary file and network loading functions ¶
Package for looking up words and multiword expressions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Dictionary ¶ added in v0.0.66
type Dictionary struct { // Forward dictionary, lookup by Chinese word Wdict map[string]*dicttypes.Word HeadwordIds map[int]*dicttypes.Word }
Dictionary is a struct to hold word dictionary indexes
func LoadDictFile ¶ added in v0.0.66
func LoadDictFile(appConfig config.AppConfig) (*Dictionary, error)
LoadDictFile loads all words from static files
func LoadDictURL ¶ added in v0.0.66
func LoadDictURL(appConfig config.AppConfig, url string) (*Dictionary, error)
Loads all words from a URL
func NewDictionary ¶ added in v0.0.66
func NewDictionary(wdict map[string]*dicttypes.Word) *Dictionary
type NotesProcessor ¶ added in v0.0.67
type NotesProcessor struct {
// contains filtered or unexported fields
}
Processes notes with a regular expression
func NewNotesProcessor ¶ added in v0.0.67
func NewNotesProcessor(patternList, replaceList string) NotesProcessor
newNotesProcessor creates a new notesProcessor Param
patternList a list of patterns to match regular expressions, quoted and delimited by commas replaceList a list of replacement regular expressions, same cardinality
type Searcher ¶ added in v0.0.5
type Searcher struct {
// contains filtered or unexported fields
}
Searcher looks up Chinese words by either Chinese or English.
If the dictionary searcher cannot connect to the database then it will run in degraded mode by looking up Chinese words form dictionary file.
func NewSearcher ¶ added in v0.0.5
NewSearcher initialize SQL statements
func (*Searcher) FindWordsByEnglish ¶ added in v0.0.5
func (searcher *Searcher) FindWordsByEnglish(ctx context.Context, query string) ([]dicttypes.WordSense, error)
FindWordsByEnglish returns the word senses with English approximate or Pinyin exact match
func (*Searcher) Initialized ¶ added in v0.0.17
Initialized returns true if there were no error in initialization.
type Validator ¶ added in v0.0.18
Performs validation of dictionary entries. Use NewValidator to create a Validator.
func NewValidator ¶ added in v0.0.18
Crates a Validator with the given readers Params:
posReader Reader to load the valid parts of speech from domainReader Reader to load the valid subject domains
Returns:
An initialized Validator