Skip to content

Instantly share code, notes, and snippets.

@bmschmidt
Last active March 13, 2017 03:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bmschmidt/2c270ab7b373b6b4383a603afe828a48 to your computer and use it in GitHub Desktop.
Save bmschmidt/2c270ab7b373b6b4383a603afe828a48 to your computer and use it in GitHub Desktop.
library(birdnik)
random_word <- function(key,
pos="adjective", min_count=100, n=1,
min_length = 5, max_length = 15){
param <- paste0("words.json/randomWords?hasDictionaryDef=true",
"&minCorpusCount=",min_count,
"&minLength=",min_length,
"&maxLength=",max_length,
"&limit=",n,
"&includePartOfSpeech=",pos)
raw = birdnik:::query(key = key,params = param)
do.call(rbind,lapply(raw,as.data.frame))
}
random_word(key=my_wordnik_key,pos="noun",n=3, min_count=1000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment