wubi

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2023 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const WORDS = 3
View Source
const WUBI = 2

Variables

View Source
var (
	ReadUint16 = util.ReadUint16
	ReadUint32 = util.ReadUint32
)
View Source
var FormatList = make([]Format, 0, 20)

Functions

func ReadIntN

func ReadIntN[T constraints.Integer](r io.Reader, size T) int

func ReadN

func ReadN[T constraints.Integer](r io.Reader, size T) []byte

func To2Bytes

func To2Bytes[T constraints.Integer](i T) []byte

func To4Bytes

func To4Bytes[T constraints.Integer](i T) []byte

Types

type BaiduDef

type BaiduDef struct{ Template }

func NewBaiduDef

func NewBaiduDef() *BaiduDef

func (BaiduDef) Marshal

func (BaiduDef) Marshal(di []*Entry, hasRank bool) []byte

func (BaiduDef) Unmarshal

func (BaiduDef) Unmarshal(r *bytes.Reader) []*Entry

type Custom

type Custom struct {
	Template
	// contains filtered or unexported fields
}

func NewBingling

func NewBingling() *Custom

func NewDuoduo

func NewDuoduo() *Custom

func (*Custom) Marshal

func (f *Custom) Marshal(di []*Entry, hasRank bool) []byte

func (*Custom) Unmarshal

func (f *Custom) Unmarshal(r *bytes.Reader) []*Entry

type DDdmg

type DDdmg struct{ Template }

func NewDDdmg

func NewDDdmg() *DDdmg

func (DDdmg) Unmarshal

func (DDdmg) Unmarshal(r *bytes.Reader) []*Entry

type DuoDB

type DuoDB struct{ Template }

func NewDuoDB

func NewDuoDB() *DuoDB

func (DuoDB) Unmarshal

func (DuoDB) Unmarshal(r *bytes.Reader) []*Entry

type Entry

type Entry struct {
	Word string
	Code string
	Rank int
}

func GenRank

func GenRank(di []*Entry) []*Entry

type Fcitx4Mb

type Fcitx4Mb struct{ Template }

func NewFcitx4Mb

func NewFcitx4Mb() *Fcitx4Mb

func (Fcitx4Mb) Unmarshal

func (Fcitx4Mb) Unmarshal(r *bytes.Reader) []*Entry

type Format

type Format interface {
	GetName() string
	GetID() string
	GetCanMarshal() bool
	Marshal([]*Entry, bool) []byte
	GetHasRank() bool

	Unmarshal(*bytes.Reader) []*Entry
	GetKind() int
}

func New

func New(format string) Format

type Jidian

type Jidian struct{ Template }

func NewJidian

func NewJidian() *Jidian

func (Jidian) Marshal

func (Jidian) Marshal(di []*Entry, hasRank bool) []byte

func (Jidian) Unmarshal

func (Jidian) Unmarshal(r *bytes.Reader) []*Entry

type JidianMb

type JidianMb struct{ Template }

func NewJidianMb

func NewJidianMb() *JidianMb

func (*JidianMb) Unmarshal

func (d *JidianMb) Unmarshal(r *bytes.Reader) []*Entry

type Kafan

type Kafan struct {
	Template
}

func NewKafan

func NewKafan() *Kafan

func (*Kafan) Unmarshal

func (f *Kafan) Unmarshal(r *bytes.Reader) []*Entry

type MsUDP

type MsUDP struct{ Template }

func NewMsUDP

func NewMsUDP() *MsUDP

func (MsUDP) Marshal

func (MsUDP) Marshal(di []*Entry, hasRank bool) []byte

func (*MsUDP) Unmarshal

func (f *MsUDP) Unmarshal(r *bytes.Reader) []*Entry

type MswbLex

type MswbLex struct {
	Template
	// contains filtered or unexported fields
}

func NewMswbLex

func NewMswbLex() *MswbLex

func (*MswbLex) LoadWordWeight

func (d *MswbLex) LoadWordWeight()

func (*MswbLex) Marshal

func (d *MswbLex) Marshal(di []*Entry, hasRank bool) []byte

func (*MswbLex) Unmarshal

func (f *MswbLex) Unmarshal(r *bytes.Reader) []*Entry

type Template

type Template struct {
	Name       string // 名称
	ID         string // 唯一 ID
	CanMarshal bool   // 是否可以序列化
	HasRank    bool   // 是否有 Rank
}

func (*Template) GetCanMarshal

func (t *Template) GetCanMarshal() bool

func (*Template) GetHasRank

func (t *Template) GetHasRank() bool

func (*Template) GetID

func (t *Template) GetID() string

func (*Template) GetKind

func (t *Template) GetKind() int

func (*Template) GetName

func (t *Template) GetName() string

func (*Template) Marshal

func (t *Template) Marshal([]*Entry, bool) []byte

type Words

type Words struct {
	Template
}

func NewWords

func NewWords() *Words

func (*Words) GetKind

func (f *Words) GetKind() int

func (*Words) MarshalStr

func (f *Words) MarshalStr(di []string) []byte

func (*Words) Unmarshal

func (f *Words) Unmarshal(r *bytes.Reader) []*Entry

func (*Words) UnmarshalStr added in v1.2.1

func (f *Words) UnmarshalStr(r *bytes.Reader) []string

特殊

Jump to

Keyboard shortcuts

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