webtagger 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. data/Gemfile +1 -0
  2. data/Gemfile.lock +2 -0
  3. data/README.rdoc +0 -1
  4. data/VERSION +1 -1
  5. data/lib/webtagger.rb +3 -3
  6. metadata +27 -13
data/Gemfile CHANGED
@@ -6,6 +6,7 @@ source "http://rubygems.org"
6
6
  # Add dependencies to develop your gem here.
7
7
  # Include everything needed to run rake, tests, features, etc.
8
8
  gem 'json'
9
+ gem 'simple_cache'
9
10
  group :development do
10
11
  gem "rspec", "~> 2.3.0"
11
12
  gem "bundler", "~> 1.0.0"
data/Gemfile.lock CHANGED
@@ -19,6 +19,7 @@ GEM
19
19
  rspec-expectations (2.3.0)
20
20
  diff-lcs (~> 1.1.2)
21
21
  rspec-mocks (2.3.0)
22
+ simple_cache (0.1.0)
22
23
 
23
24
  PLATFORMS
24
25
  ruby
@@ -30,3 +31,4 @@ DEPENDENCIES
30
31
  json
31
32
  rcov
32
33
  rspec (~> 2.3.0)
34
+ simple_cache
data/README.rdoc CHANGED
@@ -13,7 +13,6 @@ And it's written to support any API in the future.
13
13
 
14
14
  ==Usage
15
15
 
16
- Besides that pickle, the standard usage is really simple:
17
16
  require 'webtagger'
18
17
  text = "Hi, I'm text"
19
18
  #you simply call the appropriate method:
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.0.1
data/lib/webtagger.rb CHANGED
@@ -1,11 +1,11 @@
1
- %w{net/http json digest/md5}.each{|m| require m }
1
+ %w{net/http json simple_cache}.each{|m| require m }
2
2
 
3
3
  #Class for extracting keywords from text. Uses the tagthe, yahoo and alchemyAPI web services.
4
4
  #it uses caching to avoid being throttled by the apis, via the httparty_icebox gem
5
5
  class WebTagger
6
6
 
7
7
  #one of these days, gotta add filesystem cache
8
- @@cache = {}
8
+ @@cache = SimpleCache::MemoryCache.new
9
9
  #Macro for creating a provider-specific tagger
10
10
  def self.tags_with(service, options={}, &callback)
11
11
  opts = {:uri => "",
@@ -23,7 +23,7 @@ class WebTagger
23
23
  #hack the block: using the star operator we can get an empty second param without fuss
24
24
  define_method("tag_with_#{service.to_s}") do | text, *tokens |
25
25
 
26
- text_digest = Digest::MD5.hexdigest service.to_s+text
26
+ text_digest = service.to_s+text
27
27
  callback.call(@@cache[text_digest]) unless @@cache[text_digest].nil?
28
28
 
29
29
  query = {opts[:text_param] => text}.merge(opts[:extra_params])
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webtagger
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 0
10
- version: 1.0.0
9
+ - 1
10
+ version: 1.0.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - lfborjas
@@ -34,8 +34,22 @@ dependencies:
34
34
  type: :runtime
35
35
  - !ruby/object:Gem::Dependency
36
36
  prerelease: false
37
- name: rspec
37
+ name: simple_cache
38
38
  version_requirements: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 3
44
+ segments:
45
+ - 0
46
+ version: "0"
47
+ requirement: *id002
48
+ type: :runtime
49
+ - !ruby/object:Gem::Dependency
50
+ prerelease: false
51
+ name: rspec
52
+ version_requirements: &id003 !ruby/object:Gem::Requirement
39
53
  none: false
40
54
  requirements:
41
55
  - - ~>
@@ -46,12 +60,12 @@ dependencies:
46
60
  - 3
47
61
  - 0
48
62
  version: 2.3.0
49
- requirement: *id002
63
+ requirement: *id003
50
64
  type: :development
51
65
  - !ruby/object:Gem::Dependency
52
66
  prerelease: false
53
67
  name: bundler
54
- version_requirements: &id003 !ruby/object:Gem::Requirement
68
+ version_requirements: &id004 !ruby/object:Gem::Requirement
55
69
  none: false
56
70
  requirements:
57
71
  - - ~>
@@ -62,12 +76,12 @@ dependencies:
62
76
  - 0
63
77
  - 0
64
78
  version: 1.0.0
65
- requirement: *id003
79
+ requirement: *id004
66
80
  type: :development
67
81
  - !ruby/object:Gem::Dependency
68
82
  prerelease: false
69
83
  name: jeweler
70
- version_requirements: &id004 !ruby/object:Gem::Requirement
84
+ version_requirements: &id005 !ruby/object:Gem::Requirement
71
85
  none: false
72
86
  requirements:
73
87
  - - ~>
@@ -78,12 +92,12 @@ dependencies:
78
92
  - 5
79
93
  - 2
80
94
  version: 1.5.2
81
- requirement: *id004
95
+ requirement: *id005
82
96
  type: :development
83
97
  - !ruby/object:Gem::Dependency
84
98
  prerelease: false
85
99
  name: rcov
86
- version_requirements: &id005 !ruby/object:Gem::Requirement
100
+ version_requirements: &id006 !ruby/object:Gem::Requirement
87
101
  none: false
88
102
  requirements:
89
103
  - - ">="
@@ -92,12 +106,12 @@ dependencies:
92
106
  segments:
93
107
  - 0
94
108
  version: "0"
95
- requirement: *id005
109
+ requirement: *id006
96
110
  type: :development
97
111
  - !ruby/object:Gem::Dependency
98
112
  prerelease: false
99
113
  name: fakeweb
100
- version_requirements: &id006 !ruby/object:Gem::Requirement
114
+ version_requirements: &id007 !ruby/object:Gem::Requirement
101
115
  none: false
102
116
  requirements:
103
117
  - - ~>
@@ -108,7 +122,7 @@ dependencies:
108
122
  - 3
109
123
  - 0
110
124
  version: 1.3.0
111
- requirement: *id006
125
+ requirement: *id007
112
126
  type: :development
113
127
  description: Use webtagger to use keyword extraction web services (yahoo, tagthe and alchemy) to extract from a text terms suitable for tagging, summarization, query building, etc.
114
128
  email: luisfelipe@lfborjas.com