calais 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig ADDED
@@ -0,0 +1 @@
1
+ ���Vw&�+�@6l8g8�����uɂ��H�L�E�[a�-&,���v�l���uo���#{�3�T����v��%ơ�������[���� \գ�\p��%0�K���A�PfB�Z�&����X����$� M�`�W_������F eD*�ɖ��,�^t�{�8̮$���n�V�Y���9�(c@j���F̹k |��ȏ�d�j4��ߤo �8���g��xG �wkd���X���F᭞/��
data/History.txt ADDED
@@ -0,0 +1,5 @@
1
+ == 0.0.1
2
+
3
+ * Access to Calais's Enlighten action
4
+ * Single method to process a document
5
+ * Get relationships and names from a document
data/Manifest.txt ADDED
@@ -0,0 +1,14 @@
1
+ History.txt
2
+ Manifest.txt
3
+ README.txt
4
+ Rakefile
5
+ lib/calais.rb
6
+ lib/calais/client.rb
7
+ lib/calais/response.rb
8
+ spec/calais_spec.rb
9
+ spec/fixtures/.gitignore
10
+ spec/fixtures/bicycles_austrailia.xml
11
+ spec/fixtures/calais.yml.sample
12
+ spec/fixtures/slovenia_euro.xml
13
+ spec/helper.rb
14
+ spec/spec.opts
data/README.txt ADDED
@@ -0,0 +1,39 @@
1
+ == Calais
2
+ A Ruby interface to the Open Calais Web Service (http://opencalais.com)
3
+
4
+ == Features
5
+
6
+ * Accepts documents in text/plain, text/xml and text/html format.
7
+ * Basic access to the Open Calais API's Enlighten action.
8
+ * Output is RDF representation of input document.
9
+ * Single function ability to tag a document and receive a response in RDF format, names in the document, and their relationships.
10
+
11
+ == Synopsis
12
+
13
+ This is a very basic wrapper to the Open Calais API. It uses the POST endpoint and currently supports the Enlighten action. Here's a simple call:
14
+
15
+ Calais.enlighten(:content => "The government of the United Kingdom has given corporations like fast food chain McDonald's the right to award high school qualifications to employees who complete a company training program.", :content_type => :text, :license_id => LICENSE_ID)
16
+
17
+ This is the easiest way to get the RDF-formated response from the OpenCalais service.
18
+
19
+ If you want to do something more fun like getting all sorts of fun information about a document, you can try this:
20
+
21
+ Calais.process_document(:content => "The government of the United Kingdom has given corporations like fast food chain McDonald's the right to award high school qualifications to employees who complete a company training program.", :content_type => :text, :license_id => LICENSE_ID)
22
+
23
+ This will return an object containing the RDF representation of the text, the names in the text, and any relationships that exist there.
24
+
25
+ == Requirements
26
+
27
+ * Ruby 1.8.5 or better
28
+ * Uses the following standard libraries: digest/sha1, net/http, yaml, cgi
29
+ * Hpricot
30
+
31
+ == Install
32
+
33
+ TODO
34
+
35
+ == Authors
36
+
37
+ Abhay Kumar
38
+ http://opensynapse.net
39
+
data/Rakefile ADDED
@@ -0,0 +1,37 @@
1
+ # -*- ruby -*-
2
+
3
+ require 'rubygems'
4
+ require 'hoe'
5
+ require 'spec/rake/spectask'
6
+
7
+ require './lib/calais.rb'
8
+
9
+ Hoe.new('calais', Calais::VERSION) do |p|
10
+ p.rubyforge_name = 'calais'
11
+ p.author = 'Abhay Kumar'
12
+ p.summary = 'A Ruby interface to the Calais Web Service'
13
+ p.description = p.paragraphs_of('README.txt', 1..9).join("\n\n")
14
+ p.email = 'info@opensynapse.net'
15
+ p.url = 'http://calais.rubyforge.org'
16
+ p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
17
+ p.remote_rdoc_dir = ''
18
+ end
19
+
20
+ desc "Run all specs"
21
+ Spec::Rake::SpecTask.new do |t|
22
+ t.spec_files = FileList["spec/*_spec.rb"].sort
23
+ t.spec_opts = ["--options", "spec/spec.opts"]
24
+ end
25
+
26
+ desc "Run all specs and get coverage statistics"
27
+ Spec::Rake::SpecTask.new('coverage') do |t|
28
+ t.spec_opts = ["--options", "spec/spec.opts"]
29
+ t.spec_files = FileList["spec/*_spec.rb"].sort
30
+ t.rcov_opts = ["--exclude", "spec", "--exclude", "gems"]
31
+ t.rcov = true
32
+ end
33
+
34
+ Rake::Task[:default].prerequisites.clear
35
+ task :default => :spec
36
+
37
+ # vim: syntax=Ruby
data/lib/calais.rb ADDED
@@ -0,0 +1,47 @@
1
+ require 'digest/sha1'
2
+ require 'net/http'
3
+ require 'yaml'
4
+ require 'cgi'
5
+
6
+ require 'rubygems'
7
+ require 'hpricot'
8
+
9
+ $KCODE = "UTF8"
10
+
11
+ Dir.glob(File.join(File.dirname(__FILE__), 'calais/*.rb')).each { |f| require f }
12
+
13
+ module Calais
14
+ POST_URL = "http://api.opencalais.com"
15
+
16
+ AVAILABLE_OUTPUT_FORMATS = {
17
+ :rdf => "XML/RDF"
18
+ }
19
+ DEFAULT_OUTPUT_FORMAT = :rdf
20
+
21
+ AVAILABLE_CONTENT_TYPES = {
22
+ :xml => "TEXT/XML",
23
+ :html => "TEXT/HTML",
24
+ :text => "TEXT/TXT"
25
+ }
26
+ DEFAULT_CONTENT_TYPE = :xml
27
+
28
+ DEFAULT_SUBMITTER = "calais.rb"
29
+
30
+ AVAILABLE_METHODS = {
31
+ :enlighten => "/enlighten/calais.asmx/Enlighten"
32
+ }
33
+
34
+ MAX_RETRIES = 5
35
+
36
+ class << self
37
+ def enlighten(*args, &block) Client.new(*args, &block).call(:enlighten) end
38
+ def process_document(*args, &block)
39
+ data, error = Calais.enlighten(*args, &block)
40
+ Client.process_data(data, error)
41
+ end
42
+ end
43
+ end
44
+
45
+ module Calais
46
+ VERSION = '0.0.1'
47
+ end
@@ -0,0 +1,61 @@
1
+ module Calais
2
+ class Client
3
+ attr_accessor :license_id
4
+ attr_accessor :content
5
+ attr_accessor :content_type, :output_format
6
+ attr_accessor :allow_distribution, :allow_search, :submitter, :external_id
7
+ attr_accessor :external_metadata
8
+
9
+ def initialize(options={}, &block)
10
+ options.each {|k,v| send("#{k}=", v)}
11
+ yield(self) if block_given?
12
+ end
13
+
14
+ def call(method, times=1)
15
+ method = method.intern unless method.is_a?(Symbol)
16
+ raise ArgumentError.new("Unknown method: #{method}") unless AVAILABLE_METHODS.keys.include? method
17
+
18
+ post_args = {
19
+ "licenseID" => @license_id,
20
+ "content" => @content,
21
+ "paramsXML" => params_xml
22
+ }
23
+
24
+ url = URI.parse(POST_URL + AVAILABLE_METHODS[method])
25
+ resp, data = Net::HTTP.post_form(url, post_args)
26
+
27
+ handle_response(resp, data, method, times)
28
+ end
29
+
30
+ def self.process_data(data, error=nil)
31
+ Calais::Response.new(data, error)
32
+ end
33
+
34
+ private
35
+ def handle_response(resp, data, method, times)
36
+ if resp.is_a? Net::HTTPOK
37
+ [data, nil]
38
+ elsif times >= MAX_RETRIES
39
+ [data, "Too many retries: #{times}"]
40
+ else
41
+ call(method, times+1)
42
+ end
43
+ end
44
+
45
+ def params_xml
46
+ content_type = @content_type && AVAILABLE_CONTENT_TYPES.keys.include?(@content_type) ? AVAILABLE_CONTENT_TYPES[@content_type] : AVAILABLE_CONTENT_TYPES[DEFAULT_CONTENT_TYPE]
47
+ output_format = @output_format && AVAILABLE_OUTPUT_FORMATS.keys.include?(@output_format) ? AVAILABLE_OUTPUT_FORMATS[@output_format] : AVAILABLE_OUTPUT_FORMATS[DEFAULT_OUTPUT_FORMAT]
48
+ allow_distribution = @allow_distribution ? "true" : "false"
49
+ allow_search = @allow_search ? "true" : "false"
50
+ submitter = @submitter || DEFAULT_SUBMITTER
51
+ external_id = @external_id || Digest::SHA1.hexdigest(@content.inspect)
52
+ external_metadata = @external_metadata || ""
53
+
54
+ xml = %[<c:params xmlns:c="http://s.opencalais.com/1/pred/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">]
55
+ xml += %[<c:processingDirectives c:contentType="#{content_type}" c:outputFormat="#{output_format}"></c:processingDirectives>]
56
+ xml += %[<c:userDirectives c:allowDistribution="#{allow_distribution}" c:allowSearch="#{allow_search}" c:externalID="#{external_id}" c:submitter="#{submitter}"></c:userDirectives>]
57
+ xml += %[<c:externalMetadata>#{external_metadata}</c:externalMetadata>]
58
+ xml += %[</c:params>]
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,107 @@
1
+ module Calais
2
+ class Response
3
+ attr_reader :rdf, :names, :relationships, :error
4
+
5
+ def initialize(raw, error=nil)
6
+ @error = error
7
+ @names = []
8
+ @relationships = []
9
+
10
+ parse_rdf(raw)
11
+ parse_names
12
+ parse_relationships
13
+ end
14
+
15
+ def to_dot
16
+ used = []
17
+ id = @hpricot.at("rdf:Description//c:document//..").attributes["c:externalID"]
18
+
19
+ dot = "digraph \"#{id}\"\n"
20
+ dot += "{\n"
21
+ dot += "\tgraph [rankdir=LR, overlap=false];\n"
22
+ dot += "\tnode [shape = circle];"
23
+
24
+ @relationships.each do |rel|
25
+ dot += "\t\"#{rel.actor.name}\" -> \"#{rel.target.name}\""
26
+ dot += " ["
27
+ dot += "label=\""
28
+ dot += "#{rel.metadata} " if rel.metadata
29
+ dot += "(#{rel.type})"
30
+ dot += "\"];\n"
31
+ used |= [rel.actor.hash, rel.target.hash]
32
+ end
33
+
34
+ @names.each do |name|
35
+ dot += "\t\"#{name.name}\";\n" unless used.include?(name.hash)
36
+ end
37
+ dot += "}\n"
38
+
39
+ f = File.open("#{id}.dot", 'w')
40
+ f.puts dot
41
+ f.close
42
+
43
+ end
44
+
45
+ private
46
+ def parse_rdf(raw)
47
+ @rdf = CGI::unescapeHTML Hpricot.XML(raw).at("/string").inner_html
48
+ @hpricot = Hpricot.XML(@rdf)
49
+ @error = Hpricot.XML(response).at("/Error/Exception").inner_html rescue @error
50
+ end
51
+
52
+ def parse_names
53
+ @names = @hpricot.root.search("rdf:Description//c:name//..").map do |ele|
54
+ Calais::Response::Name.new(
55
+ :name => ele.at("c:name").inner_html,
56
+ :hash => ele.attributes["rdf:about"].split('/').last,
57
+ :type => ele.at("rdf:type").attributes["rdf:resource"].split('/').last
58
+ )
59
+ end unless @error
60
+ end
61
+
62
+ def parse_relationships
63
+ doc = Hpricot.XML(@rdf)
64
+ doc.search("rdf:Description//c:docId//..").remove
65
+ doc.search("rdf:Description//c:document//..").remove
66
+ doc.search("rdf:Description//c:name//..").remove
67
+
68
+ @relationships = doc.root.search("rdf:Description").map do |ele|
69
+ relationship = ele.at("rdf:type")
70
+ actor = relationship.next_sibling
71
+ metadata = actor.next_sibling.attributes["rdf:resource"] ? nil : actor.next_sibling.inner_html.strip
72
+ target = metadata ? actor.next_sibling.next_sibling : actor.next_sibling
73
+
74
+ actor_name = actor ? Name.find_in_names(actor.attributes["rdf:resource"].split('/').last, @names) : nil
75
+ target_name = target ? Name.find_in_names(target.attributes["rdf:resource"].split('/').last, @names) : nil
76
+
77
+ Calais::Response::Relationship.new(
78
+ :type => relationship.attributes["rdf:resource"].split('/').last,
79
+ :actor => actor_name,
80
+ :target => target_name,
81
+ :metadata => metadata
82
+ )
83
+ end
84
+ end
85
+
86
+ class Name
87
+ include Comparable
88
+ attr_accessor :name, :type, :hash
89
+
90
+ def initialize(args={})
91
+ args.each {|k,v| send("#{k}=", v)}
92
+ end
93
+
94
+ def self.find_in_names(hash, names)
95
+ names.select {|name| name.hash == hash }.first
96
+ end
97
+ end
98
+
99
+ class Relationship
100
+ attr_accessor :type, :actor, :target, :metadata
101
+
102
+ def initialize(args={})
103
+ args.each {|k,v| send("#{k}=", v)}
104
+ end
105
+ end
106
+ end
107
+ end
@@ -0,0 +1,72 @@
1
+ require File.expand_path("#{File.dirname(__FILE__)}/helper")
2
+
3
+ describe Calais do
4
+ it "provides a version number" do
5
+ Calais::VERSION.should_not be_nil
6
+ end
7
+ end
8
+
9
+ describe Calais::Client, ".new" do
10
+ it "accepts arguments as a hash" do
11
+ client = nil
12
+
13
+ lambda { client = Calais::Client.new(:content => SAMPLE_DOCUMENT, :license_id => LICENSE_ID) }.should_not raise_error(ArgumentError)
14
+
15
+ client.license_id.should == LICENSE_ID
16
+ client.content.should == SAMPLE_DOCUMENT
17
+ end
18
+
19
+ it "accepts arguments as a block" do
20
+ client = nil
21
+
22
+ lambda {
23
+ client = Calais::Client.new do |c|
24
+ c.content = SAMPLE_DOCUMENT
25
+ c.license_id = LICENSE_ID
26
+ end
27
+ }.should_not raise_error(ArgumentError)
28
+
29
+ client.license_id.should == LICENSE_ID
30
+ client.content.should == SAMPLE_DOCUMENT
31
+ end
32
+
33
+ it "should not accept unknown attributes" do
34
+ lambda { Calais::Client.new(:monkey => "monkey", :license_id => LICENSE_ID) }.should raise_error(NoMethodError)
35
+ end
36
+ end
37
+
38
+ describe Calais, ".process_document" do
39
+ it "returns a Calais::Response" do
40
+ response = Calais.process_document(:content => SAMPLE_DOCUMENT, :content_type => :xml, :license_id => LICENSE_ID)
41
+ response.should_not be_nil
42
+ response.should be_a_kind_of(Calais::Response)
43
+ end
44
+
45
+ it "returns a Calais::Response (with relationships)" do
46
+ response = Calais.process_document(:content => File.read(File.join(File.dirname(__FILE__), 'fixtures', 'bicycles_austrailia.xml')), :content_type => :xml, :license_id => LICENSE_ID)
47
+ response.should_not be_nil
48
+ response.should be_a_kind_of(Calais::Response)
49
+ end
50
+ end
51
+
52
+ describe Calais::Client, ".call" do
53
+ before(:all) do
54
+ @client = Calais::Client.new(:content => SAMPLE_DOCUMENT, :license_id => LICENSE_ID)
55
+ end
56
+
57
+ it "accepts known methods" do
58
+ lambda { @client.call('enlighten') }.should_not raise_error(ArgumentError)
59
+ end
60
+
61
+ it "complains about unkown methods" do
62
+ lambda { @client.call('monkey') }.should raise_error(ArgumentError)
63
+ end
64
+ end
65
+
66
+ describe Calais::Client, ".params_xml" do
67
+ it "returns an xml encoded string" do
68
+ client = Calais::Client.new(:content => SAMPLE_DOCUMENT, :content_type => :xml, :license_id => LICENSE_ID)
69
+ client.send("params_xml").should_not be_nil
70
+ client.send("params_xml").should == %[<c:params xmlns:c=\"http://s.opencalais.com/1/pred/\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"><c:processingDirectives c:contentType=\"TEXT/XML\" c:outputFormat=\"XML/RDF\"></c:processingDirectives><c:userDirectives c:allowDistribution=\"false\" c:allowSearch=\"false\" c:externalID=\"dc68d5a382724c2238d9f22ba9c0b4d2581569d8\" c:submitter=\"calais.rb\"></c:userDirectives><c:externalMetadata></c:externalMetadata></c:params>]
71
+ end
72
+ end
@@ -0,0 +1 @@
1
+ calais.yml
@@ -0,0 +1,18 @@
1
+ <document>
2
+ <id>57831</id>
3
+ <title>Record number of bicycles sold in Australia in 2006</title>
4
+ <date>January 4, 2007</date>
5
+ <body>
6
+ Bicycle sales in Australia have recorded record sales of 1,273,781 units for 2006, exceeding car sales by 32 percent. It is the fifth year in a row that the bicycle industry has sold more than one million units, a figure yet to be realised by car manufacturers.
7
+
8
+ The Cycling Promotion Fund (CPF) spokesman Ian Christie said Australians were increasingly using bicycles as an alternative to cars. Sales rose nine percent in 2006 while the car market stalled. Mr Christie said people were looking to cut their fuel costs and improve their fitness.
9
+
10
+ Mr Christie said organisations were beginning to supply bicycles as a company vehicle. "There is an emerging trend towards people using bikes as their official company-supplied vehicle in place of the traditional company car," he said.
11
+
12
+ "Some of Australia's biggest corporations now have bicycle fleets, and when you add in government organisations, we now know of at least 50 organisations which operate fleets of bikes."
13
+
14
+ "Although the company bicycle is a long way from taking over from the company car, it's an important trend when you consider that nearly half of all cars sold are to company fleets."
15
+
16
+ The CPF claims most commutes to work are less than 5 kilometres (3 miles) making bicycle travel a viable alternative.
17
+
18
+ </body></document>
@@ -0,0 +1 @@
1
+ key: asdlfkjasg08ahng2g08agds
@@ -0,0 +1,14 @@
1
+ <document>
2
+ <id>57507</id>
3
+ <title>Slovenia adopts euro</title>
4
+ <date>January 1, 2007</date>
5
+ <body>
6
+ in Europe.]]
7
+
8
+ On January 1 2007, [[Slovenia]] officially joined the Eurozone and adopted the euro as its new official currency. At the same time, Slovenian euro coins, which were available as a "starter kit" from December 15, became legal tender everywhere in the Eurozone.
9
+
10
+ A period of dual circulation, when both the former currency, the tolar and the euro will be accepted, will only last until January 14. All banks are going to exchange tolars into euros at the official rate of 239.64 SIT per 1 EUR at no commission until March 1, 2007. After that date it will be possible to exchange tolar banknotes (unlimited) and coins (until 2016) only at the Bank of Slovenia.
11
+
12
+ Most ATMs already dispense euro banknotes with the rest to follow in the following days. Commercial banks automatically converted all tolar accounts into euros and online banking systems will be accessible to their users again on January 3. Even though January 1 and 2 are non-working days in Slovenia, many banks will be opened from 10:00 to 14:00 on both days, available only for one service: exchanging tolars to euros and larger euro banknotes into smaller units.
13
+
14
+ </body></document>
data/spec/helper.rb ADDED
@@ -0,0 +1,8 @@
1
+ require 'rubygems'
2
+ require 'spec'
3
+ require 'yaml'
4
+
5
+ require File.dirname(__FILE__) + '/../lib/calais'
6
+
7
+ SAMPLE_DOCUMENT = File.read(File.join(File.dirname(__FILE__), 'fixtures/slovenia_euro.xml'))
8
+ LICENSE_ID = YAML.load(File.read(File.join(File.dirname(__FILE__), 'fixtures/calais.yml')))['key']
data/spec/spec.opts ADDED
@@ -0,0 +1,4 @@
1
+ --colour
2
+ --format s
3
+ --backtrace
4
+ --loadby mtime
metadata ADDED
@@ -0,0 +1,98 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: calais
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Abhay Kumar
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDNjCCAh6gAwIBAgIBADANBgkqhkiG9w0BAQUFADBBMQ0wCwYDVQQDDARpbmZv
14
+ MRswGQYKCZImiZPyLGQBGRYLb3BlbnN5bmFwc2UxEzARBgoJkiaJk/IsZAEZFgNu
15
+ ZXQwHhcNMDgwMjAzMDUwODQzWhcNMDkwMjAyMDUwODQzWjBBMQ0wCwYDVQQDDARp
16
+ bmZvMRswGQYKCZImiZPyLGQBGRYLb3BlbnN5bmFwc2UxEzARBgoJkiaJk/IsZAEZ
17
+ FgNuZXQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCmaA3Od1p42luz
18
+ zDJepXD3VBFEmmeCUCOjs8rkGIlhRibBvAU8GB0hhkTUykeF6JvAp68FYtIqyTqM
19
+ EY7bnyYTWsvX7HrX/wGRshSKZPnxn2b0AnZ9T3QQZyUut1YQ5G+kBQrI76hz9ynA
20
+ l0mPCiGxrh+yUNTKt7KzOAzQbtPlqGiIzj+aYvzmdEsj24Ekm/11A/ntPnz+N/Wj
21
+ yS5c2tbfZdU8NfwfHCZQUBE4PROYCCjoly0QChvBQzKSZPrEpJB3EedMUyBc5m5E
22
+ TQ0u5aItr3isQchwo410x7ixzVveVzn4mchaGCZ3ZuPwaQkuI/7KSSWWH1LCouct
23
+ N7LsWR7jAgMBAAGjOTA3MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQW
24
+ BBRsRhkAWj4iWaut121ZcaOAKXG27DANBgkqhkiG9w0BAQUFAAOCAQEAFuqEVgKC
25
+ U6f237SZ/hzevOwRkaErF1EcaCEVzuNj+KNdbQOK9oOo+hHyos3jUo17TiUNDi+3
26
+ VJhw3cOkA/PEpa0ou0Vm8VIfXdp6dh62NhTKHBVwQ/qXHnn3aVuV/zIfOmi9WQ+t
27
+ mr7ehGTw7URly95GOESW4NKQ95p+iquAh/NGhtHGFt+nxjJGUkkYlnGVaxmmgof3
28
+ sP2hOrejIrD9jAoejiRhiA+IyEoaYJvlh+D+3MngvnyDFqHiFZgngM0fvTnMTsgT
29
+ avOOKhLsesocjiElkLMv8mwuY+L8P4tSvDTDKXxM9Bx/YagwgzYCqPoGtFdWI/GI
30
+ +keKvrmaTOJ7CQ==
31
+ -----END CERTIFICATE-----
32
+
33
+ date: 2008-02-02 00:00:00 -08:00
34
+ default_executable:
35
+ dependencies:
36
+ - !ruby/object:Gem::Dependency
37
+ name: hoe
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 1.5.0
44
+ version:
45
+ description: "== Features * Accepts documents in text/plain, text/xml and text/html format. * Basic access to the Open Calais API's Enlighten action. * Output is RDF representation of input document. * Single function ability to tag a document and receive a response in RDF format, names in the document, and their relationships. == Synopsis This is a very basic wrapper to the Open Calais API. It uses the POST endpoint and currently supports the Enlighten action. Here's a simple call: Calais.enlighten(:content => \"The government of the United Kingdom has given corporations like fast food chain McDonald's the right to award high school qualifications to employees who complete a company training program.\", :content_type => :text, :license_id => LICENSE_ID) This is the easiest way to get the RDF-formated response from the OpenCalais service. If you want to do something more fun like getting all sorts of fun information about a document, you can try this: Calais.process_document(:content => \"The government of the United Kingdom has given corporations like fast food chain McDonald's the right to award high school qualifications to employees who complete a company training program.\", :content_type => :text, :license_id => LICENSE_ID) This will return an object containing the RDF representation of the text, the names in the text, and any relationships that exist there."
46
+ email: info@opensynapse.net
47
+ executables: []
48
+
49
+ extensions: []
50
+
51
+ extra_rdoc_files:
52
+ - History.txt
53
+ - Manifest.txt
54
+ - README.txt
55
+ files:
56
+ - History.txt
57
+ - Manifest.txt
58
+ - README.txt
59
+ - Rakefile
60
+ - lib/calais.rb
61
+ - lib/calais/client.rb
62
+ - lib/calais/response.rb
63
+ - spec/calais_spec.rb
64
+ - spec/fixtures/.gitignore
65
+ - spec/fixtures/bicycles_austrailia.xml
66
+ - spec/fixtures/calais.yml.sample
67
+ - spec/fixtures/slovenia_euro.xml
68
+ - spec/helper.rb
69
+ - spec/spec.opts
70
+ has_rdoc: true
71
+ homepage: http://calais.rubyforge.org
72
+ post_install_message:
73
+ rdoc_options:
74
+ - --main
75
+ - README.txt
76
+ require_paths:
77
+ - lib
78
+ required_ruby_version: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: "0"
83
+ version:
84
+ required_rubygems_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: "0"
89
+ version:
90
+ requirements: []
91
+
92
+ rubyforge_project: calais
93
+ rubygems_version: 1.0.1
94
+ signing_key:
95
+ specification_version: 2
96
+ summary: A Ruby interface to the Calais Web Service
97
+ test_files: []
98
+
metadata.gz.sig ADDED
Binary file