stardict

package
v1.2.1-0...-837fef5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2023 License: GPL-3.0, MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Definition

type Definition struct {
	Parts []*RecordItem
}

Definition contains translation items

type Option

type Option struct {
	DictDzFilePath string `json:"dictDzFilePath"`
	DictFilePath   string `json:"dictFilePath"`
	IdxFilePath    string `json:"idxFilePath"`
	IfoFilePath    string `json:"infoFilePath"`
}

type RawDict

type RawDict struct {
	// contains filtered or unexported fields
}

RawDict implements in-memory dictionary

func (*RawDict) GetSequence

func (d *RawDict) GetSequence(offset uint64, size uint64) []byte

GetSequence returns data at the given offset

type RawIdx

type RawIdx struct {
	// contains filtered or unexported fields
}

RawIdx implements an in-memory index for a dictionary

func NewIdx

func NewIdx() *RawIdx

NewIdx initializes idx struct

func (*RawIdx) Add

func (idx *RawIdx) Add(item string, offset uint64, size uint64)

Add adds an item to in-memory index

func (RawIdx) Get

func (idx RawIdx) Get(item string) []*Sense

Get gets all translations for an item

type RawInfo

type RawInfo struct {
	Version string
	Is64    bool
	Options map[string]string
}

RawInfo contains dictionary options

type RecordItem

type RecordItem struct {
	Type rune
	Data []byte
}

RecordItem contain single translation item

type Sense

type Sense struct {
	Offset uint64
	Size   uint64
}

Sense has information belonging to single item position in dictionary

type StarDict

type StarDict struct {
	// contains filtered or unexported fields
}

StarDict stardict dictionary

func NewStarDict

func NewStarDict(opt *Option) (*StarDict, error)

NewStarDict returns a new StarDict path - path to dictionary files name - name of dictionary to parse

func (*StarDict) BuildIndex

func (sdict *StarDict) BuildIndex() error

func (*StarDict) GetBookName

func (sdict *StarDict) GetBookName() string

GetBookName returns book name

func (*StarDict) GetWordCount

func (sdict *StarDict) GetWordCount() uint64

GetWordCount returns number of words in the dictionary

func (*StarDict) KeyList

func (sdict *StarDict) KeyList() []string

func (*StarDict) Lookup

func (sdict *StarDict) Lookup(word string) string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL