Created
April 17, 2013 09:32
-
-
Save peteryates/5403016 to your computer and use it in GitHub Desktop.
Simple thesaurus wrapper for the metanym gem
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
| ~»thesaurus boot | |
| Boot: | |
| Synonym: brogan, footwear, galoshes, mukluk, oxford, snow shoes, waders, waters | |
| Antonym: aid, defend, protect, resist, retreat, shelter, shield, submit, support, surrender, sustain |
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
| #!/usr/bin/env ruby | |
| require 'metanym' | |
| require 'colorize' | |
| SYNONYM, ANTONYM = *%w{ Synonym Antonym }.map { |type| type.concat(':').colorize(:blue) } | |
| ARGV.each do |word| | |
| Metanym.new(word).tap do |query| | |
| puts word.dup.concat(':').capitalize.colorize(:yellow) | |
| puts " #{SYNONYM} #{query.synonyms.join(', ')}" | |
| puts " #{ANTONYM} #{query.antonyms.join(', ')}" | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment