oxford-dictionary.cr
Oxford Dictionary API
Simple shard that allows you to communicate with the Oxford Dictionary API. Before installing an configuring make sure to set up a free account on their website. You'll need an api_id and api_key to make this work.
Installation
Add this to your application's shard.yml
:
dependencies:
oxford_dictionary:
github: watzon/oxford-dictionary.cr
branch: master
and run crystal deps
.
Usage
require "oxford_dictionary"
dict = OxfordDictionary.new("app_id", "app_key")
fjord = dict.define("fjord")
# fjord is now a pretty big object, to get to the
# actual definitions...
definitions = [] of String
results.each do |result|
result.lexicalEntries.each do |le|
le.entries.each do |entry|
entry.senses.each do |sense|
definitions += sense.definitions unless sense.definitions.nil?
end
end
end
end
definitions.uniq!
Development
Obviously this is not in it's ideal state, but I don't really know what it's ideal state would be. The node version offers pretty much the same API with the same response. If you feel like submitting a PR feel free to do so!
Contributing
- Fork it ( https://github.com/watzon/oxford-dictionary.cr/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
Contributors
- watzon - creator, maintainer
Repository
oxford-dictionary.cr
Owner
Statistic
- 1
- 0
- 0
- 1
- 1
- about 7 years ago
- October 23, 2017
License
MIT License
Links
Synced at
Sat, 16 Nov 2024 18:09:36 GMT
Languages