Skip to content

bachvtuan/wordnik

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 

wordnik

Golang client for WORDNIK API.

API Status:

Account

  • Pending all

Word

  • Pending all

Words

  • /words.json/search/{query}
  • /words.json/wordOfTheDay
  • /words.json/reverseDictionary
  • /words.json/randomWords
  • /words.json/randomWord

WordList

  • /word.json/{word}/examples
  • /word.json/{word}
  • /word.json/{word}/definitions
  • /word.json/{word}/topExample
  • /word.json/{word}/relatedWords
  • /word.json/{word}/pronunciations
  • /word.json/{word}/hyphenation
  • /word.json/{word}/frequency
  • /word.json/{word}/phrases
  • /word.json/{word}/etymologies
  • /word.json/{word}/audio

WordLists

  • Pending all

Example

Check out test/test.go or test/test_parallel.go .

This's the content fo test/test.go

package main 

import (
  "github.com/bachvtuan/wordnik"
  "fmt"
  "time"
)

func main() {
  
  start := time.Now()
  apiKey := "a2a73e7b926c924fad7001ca3111acd55af2ffabf50eb4ae5"
  service, err := wordnik.New( apiKey )

  if err != nil{
    panic(err)
  }

  //select word on specific date
  service.WordsService.WordOfTheDayService.Date = "2015-01-20"
  result, err := service.WordsService.WordOfTheDayService.Do()

  if err != nil{
    panic(err)
  }else{
    fmt.Printf("Word of day is %+v\n\n\n", result)
  }

  ////////////////////////////////////////////////////////////

  //Search with word begin with honey
  service.WordsService.SearchService.Query = "honey*"
  searchResult, err := service.WordsService.SearchService.Do()

  if err != nil{
    panic(err)
  }else{
    fmt.Printf("Search result is %+v\n\n\n", searchResult)
  }

  ////////////////////////////////////////////////////////////  

  //Get random words
  randomWords, err := service.WordsService.RandomWordsService.Do()

  if err != nil{
    panic(err)
  }else{
    fmt.Printf("Random words are %+v\n\n\n", randomWords)
  }

  ////////////////////////////////////////////////////////////

  //Get single random word
  randomWord, err := service.WordsService.RandomWordService.Do()

  if err != nil{
    panic(err)
  }else{
    fmt.Printf("Random word is %+v\n\n\n", randomWord)
  }

  end := time.Now()
  fmt.Printf("Executed time %v\n",  end.Sub(start))
}

About

Golang client for WORDNIK API.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages