Documentation
¶
Index ¶
Constants ¶
View Source
const ( I_bookname = "bookname" I_wordcount = "wordcount" I_description = "description" I_idxfilesize = "idxfilesize" )
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 Open ¶ added in v0.3.0
func Open(dirPathList []string, order map[string]int) ([]*Dictionary, error)
Open open directories
func (*Dictionary) BookName ¶ added in v1.0.0
func (d *Dictionary) BookName() string
BookName returns book name
func (*Dictionary) EntryCount ¶ added in v1.0.0
func (d *Dictionary) EntryCount() uint64
EntryCount returns number of entries in the dictionary
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) Search ¶ added in v1.0.0
func (d *Dictionary) Search(query string, cutoff int) []*SearchResult
Search: first try an exact match then search all translations for terms that contain the query but sort the one that have it as prefix first
type Idx ¶
type Idx struct {
// contains filtered or unexported fields
}
Idx implements an in-memory index for a dictionary
type Info ¶
Info contains dictionary options
func (Info) Description ¶ added in v1.0.0
func (Info) IndexFileSize ¶ added in v1.0.0
func (Info) MaxIdxBytes ¶ added in v1.0.0
type SearchResult ¶ added in v0.3.0
type SearchResult struct {
Terms []string
Items []*TranslationItem
Score uint8
}
type Translation ¶
type Translation struct {
Parts []*TranslationItem
}
Translation contains translation items
type TranslationItem ¶
TranslationItem contain single translation item
Click to show internal directories.
Click to hide internal directories.