Documentation ¶
Overview ¶
Package stardict implements a library for reading stardict dictionaries in pure Go.
Stardict dictionaries contain several files:
- An .ifo file that contains metadata about the dictionary.
- An .idx file that contains the dictionary index. It contains search entries and associated offsets into the .dict file. The index file can be compressed using gzip.
- A .dict file that contains the dictionary's main article data. The dict file can be compressed using the dictzip format.
- An optional .syn file that contains synonyms which link index entries.
- A .tdx file is present for "tree dictionaries" and is used instead of the .idx file.
More info on on the dictionary format can be found at this URL: https://github.com/huzheng001/stardict-3/blob/master/dict/doc/StarDictFileFormat
Index ¶
- type Entry
- type Stardict
- func (s *Stardict) Author() string
- func (s *Stardict) Bookname() string
- func (s *Stardict) Close() error
- func (s *Stardict) Description() string
- func (s *Stardict) Dict() (*dict.Dict, error)
- func (s *Stardict) Email() string
- func (s *Stardict) Index() (*idx.Idx, error)
- func (s *Stardict) IndexScanner() (*idx.Scanner, error)
- func (s *Stardict) Search(query string) ([]*Entry, error)
- func (s *Stardict) Version() string
- func (s *Stardict) Website() string
- func (s *Stardict) WordCount() int64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Entry ¶
type Entry struct {
// contains filtered or unexported fields
}
Entry is a dictionary entry.
type Stardict ¶
type Stardict struct {
// contains filtered or unexported fields
}
Stardict is a stardict dictionary.
func OpenAll ¶
OpenAll opens all dictionaries under a directory. This function will return all successfully opened dictionaries along with any errors that occurred.
func (*Stardict) Description ¶
Description returns the dictionary description.
func (*Stardict) IndexScanner ¶
IndexScanner returns a new index scanner. The caller assumes ownership of the underlying reader so Close should be called on the scanner when finished.
func (*Stardict) Search ¶
Search performs a simple full text search of the dictionary for the given query and returns dictionary entries.
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
Package dict implements reading .dict files.
|
Package dict implements reading .dict files. |
Package idx implements reading .idx files.
|
Package idx implements reading .idx files. |
Package ifo implements reading .ifo files.
|
Package ifo implements reading .ifo files. |