term_extraction 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +2 -2
- data/VERSION.yml +2 -1
- data/lib/term_extraction/yahoo.rb +5 -10
- data/lib/term_extraction/zemanta.rb +5 -8
- data/term_extraction.gemspec +6 -6
- data/test/term_extraction_test.rb +1 -1
- data/test/test_helper.rb +1 -1
- metadata +5 -4
data/Rakefile
CHANGED
@@ -11,8 +11,8 @@ begin
|
|
11
11
|
s.email = "alexrabarts@gmail.com"
|
12
12
|
s.homepage = "http://github.com/alexrabarts/term_extraction"
|
13
13
|
s.description = "Term extraction library"
|
14
|
-
s.authors = ["alex"]
|
15
|
-
s.add_dependency '
|
14
|
+
s.authors = ["alex", "Daniel Huckstep"]
|
15
|
+
s.add_dependency 'crack', ['>= 0.1.6']
|
16
16
|
end
|
17
17
|
rescue LoadError
|
18
18
|
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
data/VERSION.yml
CHANGED
@@ -1,20 +1,15 @@
|
|
1
|
-
require '
|
1
|
+
require 'crack'
|
2
2
|
require 'addressable/uri'
|
3
3
|
require 'open-uri'
|
4
4
|
|
5
5
|
class TermExtraction
|
6
6
|
class Yahoo < TermExtraction
|
7
7
|
def terms
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
data.search('//s:Result', ns).each do |n|
|
13
|
-
terms << n.text
|
14
|
-
end
|
8
|
+
begin
|
9
|
+
Crack::XML.parse(remote_xml)['ResultSet']['Result']
|
10
|
+
rescue
|
11
|
+
[]
|
15
12
|
end
|
16
|
-
|
17
|
-
terms
|
18
13
|
end
|
19
14
|
|
20
15
|
def uri
|
@@ -1,18 +1,15 @@
|
|
1
|
+
require 'crack'
|
1
2
|
require 'net/http'
|
2
|
-
require 'nokogiri'
|
3
3
|
require 'addressable/uri'
|
4
4
|
|
5
5
|
class TermExtraction
|
6
6
|
class Zemanta < TermExtraction
|
7
7
|
def terms
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
terms << n.text
|
8
|
+
begin
|
9
|
+
Crack::XML.parse(remote_xml)['rsp']['keywords']['keyword'].map { |h| h['name'] }
|
10
|
+
rescue
|
11
|
+
[]
|
13
12
|
end
|
14
|
-
|
15
|
-
terms
|
16
13
|
end
|
17
14
|
|
18
15
|
def uri
|
data/term_extraction.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{term_extraction}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["alex"]
|
12
|
-
s.date = %q{
|
11
|
+
s.authors = ["alex", "Daniel Huckstep"]
|
12
|
+
s.date = %q{2010-02-06}
|
13
13
|
s.description = %q{Term extraction library}
|
14
14
|
s.email = %q{alexrabarts@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -48,12 +48,12 @@ Gem::Specification.new do |s|
|
|
48
48
|
s.specification_version = 3
|
49
49
|
|
50
50
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
51
|
-
s.add_runtime_dependency(%q<
|
51
|
+
s.add_runtime_dependency(%q<crack>, [">= 0.1.6"])
|
52
52
|
else
|
53
|
-
s.add_dependency(%q<
|
53
|
+
s.add_dependency(%q<crack>, [">= 0.1.6"])
|
54
54
|
end
|
55
55
|
else
|
56
|
-
s.add_dependency(%q<
|
56
|
+
s.add_dependency(%q<crack>, [">= 0.1.6"])
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
@@ -6,7 +6,7 @@ class TermExtractionTest < Test::Unit::TestCase
|
|
6
6
|
fake_uri(:get, yahoo.uri, 'yahoo.xml')
|
7
7
|
assert_equal yahoo.terms, correct_yahoo_terms
|
8
8
|
end
|
9
|
-
|
9
|
+
|
10
10
|
should 'return correct terms from Zemanta' do
|
11
11
|
zemanta = TermExtraction::Zemanta.new
|
12
12
|
fake_uri(:post, zemanta.uri, 'zemanta.xml')
|
data/test/test_helper.rb
CHANGED
@@ -12,7 +12,7 @@ class Test::Unit::TestCase
|
|
12
12
|
FakeWeb.clean_registry
|
13
13
|
FakeWeb.allow_net_connect = false
|
14
14
|
response = File.open(File.join(File.dirname(__FILE__), 'fixtures', fixture)).read
|
15
|
-
FakeWeb.register_uri(method, uri.to_s, :
|
15
|
+
FakeWeb.register_uri(method, uri.to_s, :body => response)
|
16
16
|
end
|
17
17
|
|
18
18
|
def teardown
|
metadata
CHANGED
@@ -1,26 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: term_extraction
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- alex
|
8
|
+
- Daniel Huckstep
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
12
|
|
12
|
-
date:
|
13
|
+
date: 2010-02-06 00:00:00 -07:00
|
13
14
|
default_executable:
|
14
15
|
dependencies:
|
15
16
|
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
17
|
+
name: crack
|
17
18
|
type: :runtime
|
18
19
|
version_requirement:
|
19
20
|
version_requirements: !ruby/object:Gem::Requirement
|
20
21
|
requirements:
|
21
22
|
- - ">="
|
22
23
|
- !ruby/object:Gem::Version
|
23
|
-
version: 1.
|
24
|
+
version: 0.1.6
|
24
25
|
version:
|
25
26
|
description: Term extraction library
|
26
27
|
email: alexrabarts@gmail.com
|