Coder Social home page Coder Social logo

ankurgel / dictionary-rb Goto Github PK

View Code? Open in Web Editor NEW
9.0 2.0 1.0 27 KB

Provides meanings, similar words and usage examples for a word from Urban Dictionary and Dictionary Reference with CLI support

License: MIT License

Ruby 100.00%
urban-dictionary ruby cli dictionary-reference rubygem

dictionary-rb's Introduction

#dictionary-rb

Provides meanings, similar words, usage examples from Urban Dictionary and Dictionary Reference with CLI support.

##Installation

gem install dictionary-rb

##Documentation Detailed documentation is available here.

##Usage

require 'dictionary-rb'
include DictionaryRB
word = Word.new('pudding')
word.meaning
#=> "a thick, soft dessert, typically containing flour or some other thickener, milk, eggs, a flavoring, and sweetener"

#I shall haz more meanings
word.meanings
#=> ["a thick, soft dessert, typically containing flour or some other thickener, milk, eggs, a flavoring, and sweetener", "a similar dish unsweetened and served with or as a main dish", "British",.. ]


#Find urban dictionary meaning instead:
word.urban_meaning
#=> "a desert given to kids who eat their meat"


#Do more with them
word.urban.examples
#=> ["eat your meat! how can you have any pudding if you dont eat your meat?!", "  Oh, no! Get the pudding,here comes a gang of Leprechauns and children.", "Adrian says, \"I like pudding.\"", "My cousin is a whore...I think I'll name her Pudding."..]

word.dictionary.examples
#=> ["Turn into an earthen pudding-dish, cover, and cook slowly three and one-half hours.", "Turn in a buttered pudding-dish, and bake thirty-five minutes in a slow oven.", "The proof is in the pudding and if people want to make themselves feel better  for bottle feeding they can go ahead.",..]

word.urban.synonyms
#=>[ "bill cosby", "pie", "fat", "pudd"]

##CLI

  • To list all tasks
    dictionary help

  • To list help for a task
    dictionary help task_name
    example : dictionary help urban

Using meaning

> dictionary meaning boast
boast - to speak with exaggeration and excessive pride, especially about oneself

####Available options and flags:

> dictionary help meaning
Usage:
  dictionary meaning WORD

Options:
  [--words=one two three]  # Specify multiple WORDS in succession
  [--file]                 # Pass file(s) as argument(s) instead.
  [--example]              # Generate an example too.
  [--similar]              # Generate a synonym too.
  [--urban]                # Give meaning from Urban Dictionary instead.
  [--write=FILE]           # Also write results to specified FILE

gives dictionary meaning of the WORD
> dictionary meaning --words boast sly --urban --example
boast - To gloat or brag about something - He was boasting about his fly girlfriend.
sly - To do something cunningly, preferably without any one seeing, apart from your best mate to prove you did it - "Hey Jo, see that girl there? Well we danced and she i" Slllly!"ying my child!!!"

Using similar

> dictionary similar answer
answer is similar to - check

####Available options and flags

> dictionary help similar
Usage:
  dictionary similar WORD

Options:
  [--words=one two three]  # Specify multiple WORDS in succession
  [--file]                 # Pass file(s) as arugment(s) instead.
  [--urban]                # Give similar word from Urban Dictionary
  [--count=N]              # Gives N similar words
  [--write=FILE]           # Write results to specified FILE

gives syonyms of word(s)
> dictionary similar --words boast --urban --count 2
boast is similar to - annoying, humble

Similar tasks are present for "urban" and "examples", use help to discover

##Contribution

  • Fork the repository
  • Have a look at the API Documentation. It is pretty well documented with explanations of all methods and modules.
  • Do your changes in your remote branch
  • Create a pull request.
  • Earn a beer! :)

##Copyright

Copyright (c) 2014 Ankur Goel.

dictionary-rb's People

Contributors

ajaymodi avatar ankurgel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

ajaymodi

dictionary-rb's Issues

Can't get it to work

I'm completely new to Ruby so this is very likely my fault somehow, but when following the exact example you have in your README.md file I get this object which doesn't contain the meaning:

#<DictionaryRB::Word:0x007ff99a85ab38 @word="pudding">

Do you have any idea what the issue could be?

CLI/binary dictionary doesn't work with multiple words for `similar_words`

dictionary similar --words sports film --urban gives

/home/user/.rvm/gems/ruby-1.9.3-p194/gems/dictionary-rb-0.1.0/bin/dictionary:116:in `sanitize_options_words': undefined method `map' for "sports":String (NoMethodError)

Though, expression dictionary meaning --words sports film --urban works just fine.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.