drae

package
v0.0.0-...-7b7bf5d Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2019 License: MIT Imports: 12 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Sanitize

func Sanitize(s string) (string, error)

Sanitize cleans a string so that it will be accepted by the rae website.

Types

type Definition

type Definition struct {
	Category   string   `json:"category"`
	Definition string   `json:"definition"`
	Origin     []string `json:"origin"`
	Notes      []string `json:"notes"`
	Examples   []string `json:"examples"`
}

Definition represents a single definition for a word, including the category, origin etc.

type Entry

type Entry struct {
	Word        string        `json:"word"`
	Etymology   string        `json:"etymology"`
	Definitions []*Definition `json:"definitions"`
	Variations  []*Variation  `json:"variations"`
}

Entry represents a collection of definitions and variations for a given word.

func Define

func Define(word string) ([]*Entry, error)

Define is a wrapper for Scrape that takes a word you'd like to define and returns a slice of Entry's.

type NotFoundError

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

NotFoundError is a special error type that is returned when the word could not be found in the API.

func (NotFoundError) Error

func (e NotFoundError) Error() string

type Variation

type Variation struct {
	Definitions []*Definition `json:"definitions"`
	Variation   string        `json:"variation"`
}

Variation represents an alternative way to use the word, e.g. in a different context.

Jump to

Keyboard shortcuts

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