Documentation ¶
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 NotesExtractor ¶ added in v0.0.92
type NotesExtractor struct {
// contains filtered or unexported fields
}
NotesExtractor is an interface for extracting multilingual equivalents using regular expressions in the notes.
func NewNotesExtractor ¶ added in v0.0.92
func NewNotesExtractor(patternList string) (*NotesExtractor, error)
NewNotesExtractor creates a new NotesExtractor.
func (NotesExtractor) Extract ¶ added in v0.0.92
func (n NotesExtractor) Extract(notes string) []string
Extract extracts multilingual equivalents from the given note
type NotesProcessor ¶ added in v0.0.67
type NotesProcessor struct {
// contains filtered or unexported fields
}
NotesProcessor 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 ReverseIndex ¶ added in v0.0.92
type ReverseIndex interface { // Find searches from English, pinyin, or multilingual equivalents contained in notes to Chinese Find(ctx context.Context, query string) ([]dicttypes.WordSense, error) }
ReverseIndex searches the dictionary by reverse lookup, eg to Chinese
func NewReverseIndex ¶ added in v0.0.92
func NewReverseIndex(dict *Dictionary, nExtractor *NotesExtractor) ReverseIndex
type SubstringIndex ¶ added in v0.0.92
type SubstringIndex interface {
LookupSubstr(ctx context.Context, query, topic_en, subtopic_en string) (*Results, error)
}
func NewSubstringIndexDB ¶ added in v0.0.92
NewSubstringIndexDB initialize a SubstringIndexDB
func NewSubstringIndexMem ¶ added in v0.0.92
func NewSubstringIndexMem(ctx context.Context) (SubstringIndex, error)
NewSubstringIndexMem initialize a SubstringIndexMem
type SubstringIndexDB ¶ added in v0.0.92
type SubstringIndexDB struct {
// contains filtered or unexported fields
}
SubstringIndexDB looks up Chinese words by substring.
func (SubstringIndexDB) LookupSubstr ¶ added in v0.0.92
func (searcher SubstringIndexDB) LookupSubstr(ctx context.Context, query, topic_en, subtopic_en string) (*Results, error)
Lookup a term based on a substring and a topic
type SubstringIndexMem ¶ added in v0.0.92
type SubstringIndexMem struct { }
SubstringIndexMem looks up substrings from a map loaded from a file.
func (SubstringIndexMem) LookupSubstr ¶ added in v0.0.92
func (searcher SubstringIndexMem) LookupSubstr(ctx context.Context, query, topic_en, subtopic_en string) (*Results, error)
Lookup a term based on a substring and a topic
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