Documentation
¶
Index ¶
- type Dict
- type Dictionary
- func (d *Dictionary) GetBookName() string
- func (d *Dictionary) GetWordCount() uint64
- func (d *Dictionary) IterKeywords(f func(string))
- func (d *Dictionary) ResourceDir() string
- func (d *Dictionary) ResourceURL() string
- func (d *Dictionary) SearchAuto(query string) []*SearchResult
- func (d *Dictionary) SearchContains(query string) []*SearchResult
- func (d *Dictionary) SearchPrefix(query string) []*SearchResult
- func (d *Dictionary) Translate(item string) (items []*Translation)
- type Idx
- type Info
- type SearchResult
- type Sense
- type Translation
- type TranslationItem
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dict ¶
type Dict struct {
// contains filtered or unexported fields
}
Dict implements in-memory dictionary
type Dictionary ¶
type Dictionary struct {
// contains filtered or unexported fields
}
Dictionary stardict dictionary
func NewDictionary ¶
func NewDictionary(path string, name string) (*Dictionary, error)
NewDictionary returns a new Dictionary path - path to dictionary files name - name of dictionary to parse
func (*Dictionary) GetBookName ¶
func (d *Dictionary) GetBookName() string
GetBookName returns book name
func (*Dictionary) GetWordCount ¶
func (d *Dictionary) GetWordCount() uint64
GetWordCount returns number of words in the dictionary
func (*Dictionary) IterKeywords ¶ added in v0.4.0
func (d *Dictionary) IterKeywords(f func(string))
func (*Dictionary) ResourceDir ¶ added in v0.4.0
func (d *Dictionary) ResourceDir() string
func (*Dictionary) ResourceURL ¶ added in v0.4.0
func (d *Dictionary) ResourceURL() string
func (*Dictionary) SearchAuto ¶ added in v0.3.0
func (d *Dictionary) SearchAuto(query string) []*SearchResult
SearchAuto: first try an exact match then search all translations for keywords that contain the query but sort the one that have it as prefix first
func (*Dictionary) SearchContains ¶ added in v0.3.0
func (d *Dictionary) SearchContains(query string) []*SearchResult
SearchContains: search all translations for keywords that contain the query
func (*Dictionary) SearchPrefix ¶ added in v0.3.0
func (d *Dictionary) SearchPrefix(query string) []*SearchResult
SearchPrefix: search all translations for keywords that start with query
func (*Dictionary) Translate ¶
func (d *Dictionary) Translate(item string) (items []*Translation)
Translate translates given item
type Idx ¶
type Idx struct {
// contains filtered or unexported fields
}
Idx implements an in-memory index for a dictionary
func ReadIndex ¶
ReadIndex reads dictionary index into a memory and returns in-memory index structure
type SearchResult ¶ added in v0.3.0
type SearchResult struct {
Keyword string
Items []*TranslationItem
}
type Sense ¶
type Sense = [2]uint64
Sense has information belonging to single item position in dictionary
type Translation ¶
type Translation struct {
Parts []*TranslationItem
}
Translation contains translation items
type TranslationItem ¶
TranslationItem contain single translation item