thesaurus

package
v0.0.0-...-64e351a Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type DefaultThesauruser

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

func NewDefaultThesauruser

func NewDefaultThesauruser(key string) *DefaultThesauruser

NewDefaultThesauruser constructor for default API access

func (DefaultThesauruser) Get

func (d DefaultThesauruser) Get(text string) ([]byte, error)

Get fulfills Thesauruser interface

type Thesaurus

type Thesaurus struct {
	Thesauruser
}

func NewThesaurus

func NewThesaurus(getWord Thesauruser) *Thesaurus

func NewThesaurusDefault

func NewThesaurusDefault(key string) *Thesaurus

func (*Thesaurus) Translate

func (t *Thesaurus) Translate(text string) (words []*Word, err error)

type Thesauruser

type Thesauruser interface {
	Get(text string) ([]byte, error)
}

type Word

type Word struct {
	Meta struct {
		Id string `json:"id"`
		//Uuid    string `json:"uuid"`
		//Src     string `json:"src"`
		//Section string `json:"section"`
		//Target  struct {
		//	Tuuid string `json:"tuuid"`
		//	Tsrc  string `json:"tsrc"`
		//} `json:"target"`
		//Stems     []string   `json:"stems"`
		Syns      [][]string `json:"syns"`
		Ants      [][]string `json:"ants"`
		Offensive bool       `json:"offensive"`
	} `json:"meta"`
	//Hwi struct {
	//	Hw string `json:"hw"`
	//} `json:"hwi"`
	Fl string `json:"fl"`
	//Def []struct {
	//	Sseq [][][]interface{} `json:"sseq"`
	//} `json:"def"`
	Shortdef []string `json:"shortdef"`
}

Word - structured json, which is received from MerriamWebster, see https://www.dictionaryapi.com/products/json#sec-3 Deliberately, there are a lot of tags commented - they are not needed by package, however left them as maybe required someday

func (*Word) Antonyms

func (w *Word) Antonyms() [][]string

Antonyms simplified access to antonyms

func (*Word) Definition

func (w *Word) Definition() []string

Definition simplified access to definition of certain Word

func (*Word) Function

func (w *Word) Function() string

Function returns the word functions in a sentence, e.x. noun, adj etc

func (*Word) IsOffensive

func (w *Word) IsOffensive() bool

IsOffensive returns true, whether word is considered as offensive

func (*Word) Synonyms

func (w *Word) Synonyms() [][]string

Synonyms simplified access to synonyms

func (*Word) Text

func (w *Word) Text() string

Text returns word, which translation belongs to

Jump to

Keyboard shortcuts

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