dict

package
v0.0.0-...-dbf49c0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrShortRead 记录未完全读取
	ErrShortRead = errors.New("记录未读取完全")
)

Functions

This section is empty.

Types

type Interface

type Interface interface {
	Match(string) (*Record, error)
	Like(string) ([]*Record, error)
}

Interface 词典的接口

type Record

type Record struct {
	Word        string // 单词名称
	Phonetic    string // 音标,以英语英标为主
	Definition  string // 单词释义(英文),每行一个释义
	Translation string // 单词释义(中文),每行一个释义
	Pos         string // 词语位置,用 "/" 分割不同位置
	Collins     string // 柯林斯星级
	Oxford      string // 是否是牛津三千核心词汇
	Tag         string // 字符串标签:zk/中考,gk/高考,cet4/四级 等等标签,空格分割
	Bnc         int    // 英国国家语料库词频顺序
	Frq         int    // 当代语料库词频顺序
	Exchange    string // 时态复数等变换,使用 "/" 分割不同项目,见后面表格
	Detail      string // json 扩展信息,字典形式保存例句(待添加)
	Audio       string // 读音音频 url (待添加)
}

Record 词典记录

func (Record) String

func (r Record) String() string

type SimpleDict

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

SimpleDict 使用 Simple 索引的词典查询

func NewSimpleDict

func NewSimpleDict(f string) (*SimpleDict, error)

NewSimpleDict 生成查询词典并构建索引

func (*SimpleDict) Like

func (d *SimpleDict) Like(k string) ([]*Record, error)

Like 根据最左匹配原则获取满足条件的所有记录

func (*SimpleDict) Match

func (d *SimpleDict) Match(k string) (*Record, error)

Match 查询词典

Jump to

Keyboard shortcuts

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