dinosaurus 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -18,7 +18,10 @@ Or install it yourself as:
18
18
 
19
19
  ## Usage
20
20
 
21
- Add your api key using the `configure` method.
21
+ ### Basic
22
+
23
+ Add your api key using the `configure` method. If you're in the Rails
24
+ environemnt then this can be done in an initializer file.
22
25
 
23
26
  Dinosaurus.configure do |config|
24
27
  config.api_key = 'djksfhjk'
@@ -27,11 +30,44 @@ Add your api key using the `configure` method.
27
30
  Now, lookup words in the Thesaurus:
28
31
 
29
32
  require "dinosaurus"
30
-
31
33
  results = Dinosaurus.lookup('word')
32
34
 
35
+ ### Results
36
+
37
+ The 'results' object is a hash with some special accessors added.
38
+
39
+ # You can use it like a normal hash:
40
+ results['noun']
41
+ # => { 'syn' => [..., ..., ...], 'ant' => [..., ...]
42
+
43
+ # Or you can access it with symbols.
44
+ results[:noun]
45
+ # => { 'syn' => [..., ..., ...], 'ant' => [..., ...]
46
+
47
+ # Or you can take advantage of the special accesor methods. The
48
+ # methods provided are
49
+ # - synonyms
50
+ # - antonyms
51
+ # - related_terms
52
+ # - similar_terms
53
+ results.synonyms
54
+ # => [..., ..., ...]
55
+
56
+ ### Convenience Methods
57
+
58
+ Certain convenience methods are provided on the top level namespace.
59
+ Each method returns an array.
60
+
61
+ Dinosaurus.synonyms_of('word')
62
+ Dinosaurus.anyonyms_of('word')
63
+ Dinosaurus.related_to('word')
64
+ Dinosaurus.similar_to('word')
65
+
33
66
  ## Contributing
34
67
 
68
+ There is a public [Trello development board](https://trello.com/board/dinosaurus/50128d79aaa25ad30857e434) for the project
69
+ which lists ideas and todos. THat might be a good place to start if you would like to contribute.
70
+
35
71
  1. Fork it
36
72
  2. Create your feature branch (`git checkout -b my-new-feature`)
37
73
  3. Commit your changes (`git commit -am 'Add some feature'`)
@@ -5,25 +5,55 @@ require "dinosaurus/thesaurus"
5
5
  require "dinosaurus/version"
6
6
 
7
7
  module Dinosaurus
8
+ # Lookup a word in the Big Huge Thesaurus.
9
+ #
10
+ # +word+ is expected to be a string. This method is
11
+ # a no-op if the +word+ is blank as defined by ActiveSupport.
12
+ #
13
+ # Dinosaurus.lookup('people')
14
+ #
15
+ # Returns an instance of <tt>Dinosaurus::Results</tt>
8
16
  def self.lookup(word)
9
17
  Dinosaurus::Thesaurus.lookup(word)
10
18
  end
11
19
 
20
+ # Convenience method to retrieve synonyms of a +word+.
21
+ #
22
+ # Dinosaurus.synonyms_of('people')
23
+ #
24
+ # Returns an array.
12
25
  def self.synonyms_of(word)
13
26
  results = lookup(word)
14
27
  results.synonyms
15
28
  end
16
29
 
30
+ # Convenience method to retrieve antonyms of a +word+.
31
+ #
32
+ # Dinosaurus.antonyms_of('people')
33
+ #
34
+ # Returns an array.
17
35
  def self.antonyms_of(word)
18
36
  results = lookup(word)
19
37
  results.antonyms
20
38
  end
21
39
 
40
+ # Convenience method to retrieve similar terms to the
41
+ # given +word+.
42
+ #
43
+ # Dinosaurus.similar_to('people')
44
+ #
45
+ # Returns an array.
22
46
  def self.similar_to(word)
23
47
  results = lookup(word)
24
48
  results.similar_terms
25
49
  end
26
50
 
51
+ # Convenience method to retrieve terms which are
52
+ # related to the given +word+.
53
+ #
54
+ # Dinosaurus.related_to('people')
55
+ #
56
+ # Returns an array.
27
57
  def self.related_to(word)
28
58
  results = lookup(word)
29
59
  results.related_terms
@@ -1,3 +1,3 @@
1
1
  module Dinosaurus
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.10"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dinosaurus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-07-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70143840141880 !ruby/object:Gem::Requirement
16
+ requirement: &70162947795100 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70143840141880
24
+ version_requirements: *70162947795100
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: vcr
27
- requirement: &70143840141420 !ruby/object:Gem::Requirement
27
+ requirement: &70162947794620 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70143840141420
35
+ version_requirements: *70162947794620
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: webmock
38
- requirement: &70143840140880 !ruby/object:Gem::Requirement
38
+ requirement: &70162947794100 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70143840140880
46
+ version_requirements: *70162947794100
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: httparty
49
- requirement: &70143840140360 !ruby/object:Gem::Requirement
49
+ requirement: &70162947793540 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70143840140360
57
+ version_requirements: *70162947793540
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: activesupport
60
- requirement: &70143840139720 !ruby/object:Gem::Requirement
60
+ requirement: &70162947813280 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70143840139720
68
+ version_requirements: *70162947813280
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
- requirement: &70143840161820 !ruby/object:Gem::Requirement
71
+ requirement: &70162947812760 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: '0'
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *70143840161820
79
+ version_requirements: *70162947812760
80
80
  description: Ruby wrapper for the Big Huge Thesaurus APIs.
81
81
  email:
82
82
  - dtuite@gmail.com