Documentation ¶
Index ¶
- Constants
- type Attr
- type Word
- func AntSort(ws []Word) []Word
- func Antonyms(ws []Word) []Word
- func FilterComplexity(ws []Word, comp int) ([]Word, error)
- func FilterLength(ws []Word, length int) ([]Word, error)
- func FilterRelevance(ws []Word, rel int) ([]Word, error)
- func FilterUseCase(ws []Word, use int) ([]Word, error)
- func GenerateWords(r io.Reader) ([]Word, error)
- func Search(w string) ([]Word, error)
- func SynSort(ws []Word) []Word
- func Synonyms(ws []Word) []Word
Constants ¶
const ( // class of words SYNONYM = iota ANTONYM // use case of words COMMON INFORMAL NONE )
const (
// BaseURL is URL of thesaurus.com.
BaseURL = "http://www.thesaurus.com/browse"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attr ¶
type Attr struct {
// contains filtered or unexported fields
}
Attr is HTML tag attribute.
func ParseHTMLStartTagBytes ¶
ParseHTMLStartTagBytes parses HTML Starting tag and returns attribute array of the tag from byte array.
func ParseHTMLStartTagString ¶
ParseHTMLStartTagString parses HTML Starting tag and returns attribute array of the tag from string.
type Word ¶
type Word struct { // Word use case // common or informal word (if not matches, sets None) UseCase int // Word complexity // range: 1 - 3 Complexity int // Word length // range: 1 - 3 LengthRate int // Word class // synonym or antonym Class int // Word relevance // range: 3 - -3 (0 excepted) // More absolute value, more relevance. // (Maybe we can judge synonyms and antonyms by this value. // synonyms: 3 - 1, antonyms: -1 - -3) Relevance int // Word spell Spell string // contains filtered or unexported fields }
Word depends on thesaurus.com HTML source. memo: 7 WORD
func AntSort ¶
AntSort sorts Word array by relevance in descending order, and returns sorted new slices.
func FilterComplexity ¶
FilterComplexity extracts Words matched value of complexity.
func FilterLength ¶
FilterLength extracts Words matched value of lengthRate.
func FilterRelevance ¶
FilterRelevance extracts Words matched value of relevance.
func FilterUseCase ¶
FilterUseCase extracts Words matched value of useCase.
func GenerateWords ¶
GenerateWords analyzes HTML body and returns Word struct array. This function can be only used in thesaurus.com HTML source. (depends on var "re" regexp)
func SynSort ¶
SynSort sorts Word array by relevance in ascending order, and returns sorted new slices.
func (Word) VerboseString ¶
VerboseString outputs verbose information.