vocab

package
Version: v0.0.0-...-773bf47 Latest Latest
Warning

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

Go to latest
Published: May 20, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Indent = "   "

Indent for printing

Functions

func SprintSuggestions

func SprintSuggestions(sugs []string) string

SprintSuggestions returns a string of suggestions

Types

type Audio

type Audio []byte

Audio type alias to raw byte data

type Examples

type Examples struct {
	Sentences []Exsentence
}

Examples contains an individual example of word

type Exsentence

type Exsentence struct {
	Sentence string
}

Exsentence contains the actual sentence

type FullDef

type FullDef struct {
	GroupNum int       // .groupNumber
	Ordinals []Ordinal // div, id
}

FullDef ,full definition of a word

type Instance

type Instance struct {
	Type  string         // {dt}
	Datas []InstanceData // {dd}
}

Instance in which a word is used It usually consists of Type: Synonyms, Antonyms, Types, Type Of, ...

type InstanceData

type InstanceData struct {
	Words      []string // .word
	Definition string   // .definition
}

InstanceData consists of words for that particular instance it's definition if possible

type List

type List struct {
	Result *Examples
}

List contains list of examples

type Ordinal

type Ordinal struct {
	ID         string     // (id) = sxxxx, ...
	ClassType  string     // (title) = noun, adjective, ...
	Definition string     // .definition
	Examples   []string   // .example
	Instances  []Instance // .instances
}

Ordinal ,definitions belonging to certain group

type Word

type Word struct {
	Word        string
	Short       string    // .short
	Long        string    // .long
	PrimaryIDs  []string  // tbody a ,redirects to fullDefs, contains id
	FullDefs    []FullDef // .section .definition
	Audios      []Audio
	Examples    []string
	CapitalOnly bool
	// contains filtered or unexported fields
}

Word consists of 4 type of definitions: - Short Definition - Long Definition - Primary Definitions (Links to Full Definitions) - Full Definitions

func Get

func Get(word string) (*Word, []string)

Get fetches word from vocabulary.com and returns word definition, and suggestions if any

func (*Word) PlayAudio

func (w *Word) PlayAudio()

PlayAudio ,plays audio

func (*Word) SprintAnt

func (w *Word) SprintAnt() string

SprintAnt ,returns a string of antonyms

func (*Word) SprintSyn

func (w *Word) SprintSyn() string

SprintSyn ,returns a string of synonyms

func (*Word) Sprintl

func (w *Word) Sprintl() string

Sprintl ,returns long-expanded string

func (*Word) Sprints

func (w *Word) Sprints() string

Sprints ,returns shortly expanded string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL