google

package
v0.0.0-...-bdd2e6f Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Annotation

type Annotation struct {
	Pos      string     `json:"pos"`
	Terms    []string   `json:"terms"`
	Entry    []*Reverse `json:"entry"`
	BaseForm string     `json:"base_form"`
	PosEnum  int        `json:"pos_enum"`
}

type Definition

type Definition struct {
	Pos      string     `json:"pos"`
	Entry    []*Example `json:"entry"`
	BaseForm string     `json:"base_form"`
}

type Example

type Example struct {
	Gloss        string `json:"gloss"`
	DefinitionID string `json:"definition_id"`
}

type GoogleTranslate

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

func NewGoogleTranslate

func NewGoogleTranslate() *GoogleTranslate

func (*GoogleTranslate) Pronounce

func (gt *GoogleTranslate) Pronounce(q string) ([]byte, error)

Pronounce 获取指定单词发音

func (*GoogleTranslate) Translate

func (gt *GoogleTranslate) Translate(q string) (*words.Word, error)

Translate 翻译指定单词

type LdResult

type LdResult struct {
	SrcLangs            []string  `json:"srclangs"`
	SrcLangsConfidences []float64 `json:"srclangs_confidences"`
	ExtendedSrcLangs    []string  `json:"extended_srclangs"`
}

type Response

type Response struct {
	Sentences   []*Translation `json:"sentences"`
	Dict        []*Annotation  `json:"dict"`
	Src         string         `json:"src"`
	Confidence  float64        `json:"confidence"`
	Spell       *Spell         `json:"spell"`
	LdResult    *LdResult      `json:"ld_result"`
	Definitions []*Definition  `json:"definitions"`
}

func (*Response) ToWord

func (tr *Response) ToWord() *words.Word

type Reverse

type Reverse struct {
	Word               string   `json:"word"`
	ReverseTranslation []string `json:"reverse_translation"`
	Score              float64  `json:"score"`
}

Reverse 反查

type Spell

type Spell struct {
	SpellHtmlRes   string `json:"spell_html_res"`
	SpellRes       string `json:"spell_res"`
	CorrectionType []int  `json:"correction_type"`
	Confident      bool   `json:"confident"`
}

type Translation

type Translation struct {
	// 0
	Trans   string `json:"trans"`   // 中文
	Orig    string `json:"orig"`    // 英文
	Backend int    `json:"backend"` // 未知

	// 1
	TranslIt    string `json:"translit"`     // 拼音
	SrcTranslIt string `json:"src_translit"` // 音标
}

Jump to

Keyboard shortcuts

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