base

package
v0.0.0-...-348b0d6 Latest Latest
Warning

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

Go to latest
Published: May 11, 2020 License: GPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Youdao = "Youdao"
	Baidu  = "Baidu"
)

单词来源

View Source
const (
	Online = FromStorage(iota)
	MemCache
)

FromStorage

View Source
const (
	CacheCapacity = 10
)
View Source
const (
	EnvTermDictRootKey = "TERMDICT_DIR"
)
View Source
const (
	Verb = iota
)

词性,暂时不用

Variables

View Source
var (
	// 是否显示例句来源
	OptShowExampleSrc = false
	// 是否显示查询结果的来源
	OptShowResultSrc = true
	// 词性和解释是否分行显示
	// true : <pos> <trans>
	// false: - 词性: <pos>
	//			释义: <trans>
	OptSeparatePosAndTrans = false
)
View Source
var (
	EnvTermDictRoot  string = "~/TermdictCache/"
	EnvTermDictCache string
)
View Source
var (
	RegexCacheFileName, _ = regexp.Compile(`\w+`)
)

Functions

func Initialize

func Initialize()

Types

type Dict

type Dict interface {
	LookUp(word string) *Word
}

type Example

type Example struct {
	Sentence    string     `yaml:"英"`
	Translation string     `yaml:"中"`
	From        ExampleSrc `yaml:"源,omitempty"`
}

例句,包括英文、中文以及例句出处

type ExampleSrc

type ExampleSrc string

func (ExampleSrc) IsZero

func (f ExampleSrc) IsZero() bool

type FromStorage

type FromStorage int

存储位置

func (FromStorage) IsZero

func (w FromStorage) IsZero() bool

type Pronunciation

type Pronunciation string

发音

type Translation

type Translation struct {
	//词性 position of speech
	POS string `yaml:"词性,omitempty"`
	//目标语言释义
	Trans string `yaml:"释"`
}

func (Translation) String

func (t Translation) String() string

type Word

type Word struct {
	Spell     string          `yaml:"单词"`
	Trans     []Translation   `yaml:"解释"`
	Pronounce []Pronunciation `yaml:"发音,omitempty,flow"`
	Examples  []Example       `yaml:"例句,omitempty"`
	Source    WordSrc         `yaml:"来源,omitempty"`
	From      FromStorage     `yaml:"存储位置,omitempty"`
}

单词

func (*Word) Key

func (w *Word) Key() string

func (Word) String

func (w Word) String() string

type WordSrc

type WordSrc string

func (WordSrc) IsZero

func (w WordSrc) IsZero() bool

Jump to

Keyboard shortcuts

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