calais 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,9 @@
1
1
  # Changes
2
2
 
3
+ ## 0.0.10
4
+
5
+ * community patch to expose SocialTags
6
+
3
7
  ## 0.0.9
4
8
 
5
9
  * updates related to API changes
@@ -39,4 +43,4 @@
39
43
  ## 0.0.1
40
44
  * Access to OpenCalais's Enlighten action
41
45
  * Single method to process a document
42
- * Get relationships and names from a document
46
+ * Get relationships and names from a document
@@ -47,3 +47,4 @@ You can install the Calais gem via Rubygems (`gem install calais`) or by buildin
47
47
  ## Acknowledgements ##
48
48
 
49
49
  * [Paul Legato](http://www.economaton.com/): Help all around with the new response processor and implementation of the 3.1 API.
50
+ * [Ryan Ong][http://www.ryanong.net/]
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 0
4
+ :patch: 10
4
5
  :build:
5
- :patch: 9
@@ -13,7 +13,7 @@ module Calais
13
13
  }
14
14
 
15
15
  attr_accessor :submitter_code, :signature, :language, :submission_date, :request_id, :doc_title, :doc_date
16
- attr_accessor :hashes, :entities, :relations, :geographies, :categories
16
+ attr_accessor :hashes, :entities, :relations, :geographies, :categories, :socialtags
17
17
 
18
18
  def initialize(rdf_string)
19
19
  @raw_response = rdf_string
@@ -24,7 +24,8 @@ module Calais
24
24
  @geographies = []
25
25
  @relevances = {} # key = String hash, val = Float relevance
26
26
  @categories = []
27
-
27
+ @socialtags = []
28
+
28
29
  extract_data
29
30
  end
30
31
 
@@ -44,6 +45,10 @@ module Calais
44
45
  attr_accessor :name, :score
45
46
  end
46
47
 
48
+ class SocailTag
49
+ attr_accessor :name, :importance
50
+ end
51
+
47
52
  class Instance
48
53
  attr_accessor :prefix, :exact, :suffix, :offset, :length
49
54
 
@@ -105,6 +110,16 @@ module Calais
105
110
  node.remove
106
111
  end
107
112
 
113
+ @socialtags = doc.root.xpath("rdf:Description/c:socialtag/..").map do |node|
114
+ tag = SocailTag.new
115
+ tag.name = node.xpath("c:name[1]").first.content
116
+ tag.importance = node.xpath("c:importance[1]").first.content.to_i
117
+
118
+ node.remove if node.xpath("c:categoryName[1]").first.nil?
119
+
120
+ tag
121
+ end
122
+
108
123
  @categories = doc.root.xpath("rdf:Description/rdf:type[contains(@rdf:resource, '#{MATCHERS[:doccat]}')]/..").map do |node|
109
124
  category = Category.new
110
125
  category.name = node.xpath("c:categoryName[1]").first.content
metadata CHANGED
@@ -1,12 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calais
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 0
8
- - 9
9
- version: 0.0.9
4
+ version: 0.0.10
10
5
  platform: ruby
11
6
  authors:
12
7
  - Abhay Kumar
@@ -14,51 +9,39 @@ autorequire:
14
9
  bindir: bin
15
10
  cert_chain: []
16
11
 
17
- date: 2010-04-14 00:00:00 -07:00
12
+ date: 2010-07-21 00:00:00 -07:00
18
13
  default_executable:
19
14
  dependencies:
20
15
  - !ruby/object:Gem::Dependency
21
16
  name: nokogiri
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
24
20
  requirements:
25
21
  - - ">="
26
22
  - !ruby/object:Gem::Version
27
- segments:
28
- - 1
29
- - 3
30
- - 3
31
23
  version: 1.3.3
32
- type: :runtime
33
- version_requirements: *id001
24
+ version:
34
25
  - !ruby/object:Gem::Dependency
35
26
  name: json
36
- prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
38
30
  requirements:
39
31
  - - ">="
40
32
  - !ruby/object:Gem::Version
41
- segments:
42
- - 1
43
- - 1
44
- - 3
45
33
  version: 1.1.3
46
- type: :runtime
47
- version_requirements: *id002
34
+ version:
48
35
  - !ruby/object:Gem::Dependency
49
36
  name: curb
50
- prerelease: false
51
- requirement: &id003 !ruby/object:Gem::Requirement
37
+ type: :runtime
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
52
40
  requirements:
53
41
  - - ">="
54
42
  - !ruby/object:Gem::Version
55
- segments:
56
- - 0
57
- - 1
58
- - 4
59
43
  version: 0.1.4
60
- type: :runtime
61
- version_requirements: *id003
44
+ version:
62
45
  description: A Ruby interface to the Calais Web Service
63
46
  email: info@opensynapse.net
64
47
  executables: []
@@ -91,20 +74,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
91
74
  requirements:
92
75
  - - ">="
93
76
  - !ruby/object:Gem::Version
94
- segments:
95
- - 0
96
77
  version: "0"
78
+ version:
97
79
  required_rubygems_version: !ruby/object:Gem::Requirement
98
80
  requirements:
99
81
  - - ">="
100
82
  - !ruby/object:Gem::Version
101
- segments:
102
- - 0
103
83
  version: "0"
84
+ version:
104
85
  requirements: []
105
86
 
106
87
  rubyforge_project: calais
107
- rubygems_version: 1.3.6
88
+ rubygems_version: 1.3.5
108
89
  signing_key:
109
90
  specification_version: 3
110
91
  summary: A Ruby interface to the Calais Web Service