Documentation ¶
Index ¶
- Constants
- func ApplyDictsOrder(order map[string]int)
- func CloseDictFiles()
- func GetInfoList() []common.Info
- func Init(directoryList []string, order map[string]int)
- func LookupHTML(query string, conf *config.Config, dictsOrder map[string]int) []common.QueryResult
- func Reorder(order map[string]int)
- type DicListSorter
- type Dict
- type Dictionary
- type Idx
- type IdxEntry
- type Info
- type QueryResultImp
- type SearchResult
- type SearchResultItem
- type WordPrefixMap
Constants ¶
View Source
const ( I_bookname = "bookname" I_wordcount = "wordcount" I_description = "description" I_idxfilesize = "idxfilesize" )
Variables ¶
This section is empty.
Functions ¶
func ApplyDictsOrder ¶
func CloseDictFiles ¶
func CloseDictFiles()
func GetInfoList ¶
func LookupHTML ¶
Types ¶
type DicListSorter ¶
type DicListSorter struct { Order map[string]int List []*Dictionary }
func (DicListSorter) Len ¶
func (s DicListSorter) Len() int
func (DicListSorter) Less ¶
func (s DicListSorter) Less(i, j int) bool
func (DicListSorter) Swap ¶
func (s DicListSorter) Swap(i, j int)
type Dict ¶
type Dict struct {
// contains filtered or unexported fields
}
Dict implements in-memory dictionary
func (*Dict) GetSequence ¶
GetSequence returns data at the given offset
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 ¶
func Open(dirPathList []string, order map[string]int) ([]*Dictionary, error)
Open open directories
func (*Dictionary) EntryCount ¶
func (d *Dictionary) EntryCount() uint64
EntryCount returns number of entries in the dictionary
func (*Dictionary) ResourceDir ¶
func (d *Dictionary) ResourceDir() string
func (*Dictionary) ResourceURL ¶
func (d *Dictionary) ResourceURL() string
func (*Dictionary) Search ¶
func (d *Dictionary) Search(query string) []*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 ¶
func (Info) EntryCount ¶
EntryCount returns number of words in the dictionary
func (Info) IndexFileSize ¶
func (Info) MaxIdxBytes ¶
type QueryResultImp ¶
type QueryResultImp struct { *SearchResult // contains filtered or unexported fields }
func (*QueryResultImp) DefinitionsHTML ¶
func (r *QueryResultImp) DefinitionsHTML() []string
func (*QueryResultImp) DictName ¶
func (r *QueryResultImp) DictName() string
func (*QueryResultImp) ResourceDir ¶
func (r *QueryResultImp) ResourceDir() string
func (*QueryResultImp) Score ¶
func (r *QueryResultImp) Score() uint8
func (*QueryResultImp) Terms ¶
func (r *QueryResultImp) Terms() []string
type SearchResult ¶
type SearchResult struct {
// contains filtered or unexported fields
}
type SearchResultItem ¶
SearchResultItem contain single translation item
type WordPrefixMap ¶
func (WordPrefixMap) Add ¶
func (wpm WordPrefixMap) Add(term string, termIndex int)
Click to show internal directories.
Click to hide internal directories.