Last active
November 10, 2016 23:55
-
-
Save dmmfll/3c668c4608ee46f584075d4906ad0327 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'json' | |
require 'httparty' | |
url = 'http://api.wordnik.com/v4/word.json/record/definitions?limit=200&includeRelated=true&useCanonical=false&includeTags=false&api_key=a2a73e7b926c924fad7001ca3111acd55af2ffabf50eb4ae5' | |
response = HTTParty.get(url) | |
api_response = JSON.parse(response.body) | |
puts api_response.class | |
api_response = JSON.parse(api_response) | |
puts api_response.class | |
filtered_results = api_response.map do |datum| | |
datum['partOfSpeech'] | |
end | |
filtered_results.uniq.map do |attr| | |
attr if attr.include? 'verb' | |
end.compact.length > 0 | |
[1, 1, 1,].uniq | |
[1, nil, nil, false, nil, 0].compact | |
[nil, nil, nil].compact.length | |
[1, nil, nil, false, nil, 0].compact.length | |
keys = ["textProns", "sourceDictionary", "exampleUses", "relatedWords", "labels", "citations", "word", "partOfSpeech", "attributionText", "sequence", "text", "score"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment