Documentation
¶
Overview ¶
Package dict implements reading .dict files.
Index ¶
Constants ¶
const ( // UTFTextType is utf-8 text. UTFTextType = DataType('m') // LocaleTextType is text in a locale encoding. LocaleTextType = DataType('l') // PangoTextType is utf-8 text in the Pango text format. PangoTextType = DataType('g') // PhoneticType is utf-8 text representing an English phonetic string. PhoneticType = DataType('t') // XDXFType is utf-8 encoded xml in XDXF format. XDXFType = DataType('x') // YinBiaoOrKataType is utf-8 encoded Yin Biao or Kana phonetic string. YinBiaoOrKataType = DataType('y') // PowerWordType is a utf-8 encoded KingSoft PowerWord XML format. PowerWordType = DataType('p') // MediaWikiType is utf-8 encoded text in MediaWiki format. MediaWikiType = DataType('w') // HTMLType is utf-8 encoded HTML text. HTMLType = DataType('h') // WordNetType is WordNet data. WordNetType = DataType('n') // ResourceFileListType is a list of files in resource storage. ResourceFileListType = DataType('r') // WavType is .wav sound file data. WavType = DataType('W') // PictureType is image file data. This was used by the // stardict-advertisement-plugin. Images are better stored in a resource // file list. PictureType = DataType('P') // ExperimentalType is reserved for experimental features. ExperimentalType = DataType('X') )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DataType ¶
type DataType byte
DataType is a type of data in a word. Data types are specified by a single byte at the beginning of a word. Lower case characters represent string-like data that is terminated by a null terminator ('\0'). Upper case characters represent file-like data that starts with a 32-bit size followed by file data.
type Dict ¶
type Dict struct {
// contains filtered or unexported fields
}
Dict represents a Stardict dictionary's dictionary data.
func New ¶
func New(r ReaderAtCloser, options *Options) (*Dict, error)
New returns a new Dict from the given reader. Dict takes ownership of the reader. The reader can be closed via the Dict's Close method.
func NewFromIfoPath ¶
NewFromIfoPath opens the dict file given the path to the .ifo file.
type Options ¶
type Options struct {
// SameTypeSequence is an option that indicates that each word in the .dict
// file will have the same sequence of data types. This is equivalent to
// the sametypesequence option from the .ifo file..
//
// See: https://github.com/huzheng001/stardict-3/blob/master/dict/doc/StarDictFileFormat
SameTypeSequence []DataType
}
Options are options for the dict data.
type ReaderAtCloser ¶
ReaderAtCloser is an interface that wraps the io.ReaderAt and io.Closer interfaces.