webtagger 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -0
- data/Gemfile.lock +2 -0
- data/README.rdoc +0 -1
- data/VERSION +1 -1
- data/lib/webtagger.rb +3 -3
- metadata +27 -13
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
data/README.rdoc
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.1
|
data/lib/webtagger.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
%w{net/http json
|
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 =
|
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:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.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:
|
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: *
|
63
|
+
requirement: *id003
|
50
64
|
type: :development
|
51
65
|
- !ruby/object:Gem::Dependency
|
52
66
|
prerelease: false
|
53
67
|
name: bundler
|
54
|
-
version_requirements: &
|
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: *
|
79
|
+
requirement: *id004
|
66
80
|
type: :development
|
67
81
|
- !ruby/object:Gem::Dependency
|
68
82
|
prerelease: false
|
69
83
|
name: jeweler
|
70
|
-
version_requirements: &
|
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: *
|
95
|
+
requirement: *id005
|
82
96
|
type: :development
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
prerelease: false
|
85
99
|
name: rcov
|
86
|
-
version_requirements: &
|
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: *
|
109
|
+
requirement: *id006
|
96
110
|
type: :development
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
prerelease: false
|
99
113
|
name: fakeweb
|
100
|
-
version_requirements: &
|
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: *
|
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
|