jm-calais 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,3 @@
1
+ module Calais
2
+ VERSION = "0.0.13"
3
+ end
data/lib/calais.rb ADDED
@@ -0,0 +1,59 @@
1
+ require 'digest/sha1'
2
+ require 'net/http'
3
+ require 'uri'
4
+ require 'cgi'
5
+ require 'iconv' if RUBY_VERSION.to_f < 1.9
6
+ require 'set'
7
+ require 'date'
8
+
9
+ require 'rubygems'
10
+ require 'nokogiri'
11
+ require 'json'
12
+
13
+ if RUBY_VERSION.to_f < 1.9
14
+ $KCODE = "UTF8"
15
+ require 'jcode'
16
+ end
17
+
18
+ $:.unshift File.expand_path(File.dirname(__FILE__))
19
+
20
+ require 'calais/client'
21
+ require 'calais/response'
22
+ require 'calais/error'
23
+
24
+ module Calais
25
+ REST_ENDPOINT = "http://api.opencalais.com/enlighten/rest/"
26
+ BETA_REST_ENDPOINT = "http://beta.opencalais.com/enlighten/rest/"
27
+
28
+ AVAILABLE_CONTENT_TYPES = {
29
+ :xml => 'text/xml',
30
+ :html => 'text/html',
31
+ :htmlraw => 'text/htmlraw',
32
+ :raw => 'text/raw'
33
+ }
34
+
35
+ AVAILABLE_OUTPUT_FORMATS = {
36
+ :rdf => 'xml/rdf',
37
+ :simple => 'text/simple',
38
+ :microformats => 'text/microformats',
39
+ :json => 'application/json'
40
+ }
41
+
42
+ KNOWN_ENABLES = ['GenericRelations', 'SocialTags']
43
+ KNOWN_DISCARDS = ['er/Company', 'er/Geo', 'er/Product']
44
+
45
+ MAX_RETRIES = 5
46
+ HTTP_TIMEOUT = 60
47
+ MIN_CONTENT_SIZE = 1
48
+ MAX_CONTENT_SIZE = 100_000
49
+
50
+ class << self
51
+ def enlighten(*args, &block); Client.new(*args, &block).enlighten; end
52
+
53
+ def process_document(*args, &block)
54
+ client = Client.new(*args, &block)
55
+ client.output_format = :rdf
56
+ Response.new(client.enlighten)
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,79 @@
1
+ require File.join(File.dirname(__FILE__), %w[.. helper])
2
+
3
+ describe Calais::Client, :new do
4
+ it 'accepts arguments as a hash' do
5
+ client = nil
6
+
7
+ lambda { client = Calais::Client.new(:content => SAMPLE_DOCUMENT, :license_id => LICENSE_ID) }.should_not raise_error
8
+
9
+ client.license_id.should == LICENSE_ID
10
+ client.content.should == SAMPLE_DOCUMENT
11
+ end
12
+
13
+ it 'accepts arguments as a block' do
14
+ client = nil
15
+
16
+ lambda {
17
+ client = Calais::Client.new do |c|
18
+ c.content = SAMPLE_DOCUMENT
19
+ c.license_id = LICENSE_ID
20
+ end
21
+ }.should_not raise_error
22
+
23
+ client.license_id.should == LICENSE_ID
24
+ client.content.should == SAMPLE_DOCUMENT
25
+ end
26
+
27
+ it 'should not accept unknown attributes' do
28
+ lambda { Calais::Client.new(:monkey => 'monkey', :license_id => LICENSE_ID) }.should raise_error(NoMethodError)
29
+ end
30
+ end
31
+
32
+ describe Calais::Client, :params_xml do
33
+ it 'returns an xml encoded string' do
34
+ client = Calais::Client.new(:content => SAMPLE_DOCUMENT, :license_id => LICENSE_ID)
35
+ client.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#\">\n <c:processingDirectives/>\n <c:userDirectives/>\n</c:params>]
36
+
37
+ client.content_type = :xml
38
+ client.output_format = :json
39
+ client.reltag_base_url = 'http://opencalais.com'
40
+ client.calculate_relevance = true
41
+ client.metadata_enables = Calais::KNOWN_ENABLES
42
+ client.metadata_discards = Calais::KNOWN_DISCARDS
43
+ client.allow_distribution = true
44
+ client.allow_search = true
45
+ client.external_id = Digest::SHA1.hexdigest(client.content)
46
+ client.submitter = 'calais.rb'
47
+
48
+ client.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#">\n <c:processingDirectives c:contentType="text/xml" c:outputFormat="application/json" c:reltagBaseURL="http://opencalais.com" c:enableMetadataType="GenericRelations,SocialTags" c:discardMetadata="er/Company;er/Geo;er/Product"/>\n <c:userDirectives c:allowDistribution="true" c:allowSearch="true" c:externalID="1a008b91e7d21962e132bc1d6cb252532116a606" c:submitter="calais.rb"/>\n</c:params>]
49
+ end
50
+ end
51
+
52
+ describe Calais::Client, :enlighten do
53
+ before do
54
+ @client = Calais::Client.new do |c|
55
+ c.content = SAMPLE_DOCUMENT
56
+ c.license_id = LICENSE_ID
57
+ c.content_type = :xml
58
+ c.output_format = :json
59
+ c.calculate_relevance = true
60
+ c.metadata_enables = Calais::KNOWN_ENABLES
61
+ c.allow_distribution = true
62
+ c.allow_search = true
63
+ end
64
+ end
65
+
66
+ it 'provides access to the enlighten command on the generic rest endpoint' do
67
+ @client.should_receive(:do_request).with(anything).and_return(SAMPLE_RESPONSE)
68
+ @client.enlighten
69
+ @client.url.should == URI.parse(Calais::REST_ENDPOINT)
70
+ end
71
+
72
+ it 'provides access to the enlighten command on the beta rest endpoint' do
73
+ @client.use_beta = true
74
+
75
+ @client.should_receive(:do_request).with(anything).and_return(SAMPLE_RESPONSE)
76
+ @client.enlighten
77
+ @client.url.should == URI.parse(Calais::BETA_REST_ENDPOINT)
78
+ end
79
+ end
@@ -0,0 +1,149 @@
1
+ require File.join(File.dirname(__FILE__), %w[.. helper])
2
+
3
+ describe Calais::Response, :new do
4
+ it 'accepts an rdf string to generate the response object' do
5
+ lambda { Calais::Response.new(SAMPLE_RESPONSE) }.should_not raise_error
6
+ end
7
+ end
8
+
9
+ describe Calais::Response, :new do
10
+ it "should return error message in runtime error" do
11
+ lambda {
12
+ @response = Calais::Response.new(RESPONSE_WITH_EXCEPTION)
13
+ }.should raise_error(Calais::Error, "My Error Message")
14
+ end
15
+ end
16
+
17
+ describe Calais::Response, :new do
18
+ before :all do
19
+ @response = Calais::Response.new(SAMPLE_RESPONSE)
20
+ end
21
+
22
+ it 'should extract document information' do
23
+ @response.language.should == 'English'
24
+ @response.submission_date.should be_a_kind_of(DateTime)
25
+ @response.signature.should be_a_kind_of(String)
26
+ @response.submitter_code.should be_a_kind_of(String)
27
+ @response.request_id.should be_a_kind_of(String)
28
+ @response.doc_title.should == 'Record number of bicycles sold in Australia in 2006'
29
+ @response.doc_date.should be_a_kind_of(Date)
30
+ end
31
+
32
+ it 'should extract entities' do
33
+ entities = @response.entities
34
+ entities.map { |e| e.type }.sort.uniq.should == %w[City Continent Country IndustryTerm Organization Person Position ProvinceOrState]
35
+ end
36
+
37
+ it 'should extract relations' do
38
+ relations = @response.relations
39
+ relations.map { |e| e.type }.sort.uniq.should == %w[GenericRelations PersonAttributes PersonCareer Quotation]
40
+ end
41
+
42
+ describe 'geographies' do
43
+ it 'should be extracted' do
44
+ geographies = @response.geographies
45
+ geographies.map { |e| e.name }.sort.uniq.should == %w[Australia Hobart,Tasmania,Australia Tasmania,Australia]
46
+ end
47
+
48
+ it 'should have relevance' do
49
+ geographies = @response.geographies
50
+ geographies.map { |e| e.relevance }.sort.uniq.should be_true
51
+ end
52
+
53
+ it 'should have relevance value' do
54
+ geographies = @response.geographies
55
+ geographies.map { |e| e.relevance }.sort.uniq.should == [0.168, 0.718]
56
+ end
57
+ end
58
+
59
+ it 'should extract relevances' do
60
+ @response.instance_variable_get(:@relevances).should be_a_kind_of(Hash)
61
+ end
62
+
63
+ it 'should assign a floating-point relevance to each entity' do
64
+ @response.entities.each {|e| e.relevance.should be_a_kind_of(Float) }
65
+ end
66
+
67
+ it 'should find the correct document categories returned by OpenCalais' do
68
+ @response.categories.map {|c| c.name }.sort.should == %w[Business_Finance Technology_Internet]
69
+ end
70
+
71
+ it 'should find the correct document category scores returned by OpenCalais' do
72
+ @response.categories.map {|c| c.score.should be_a_kind_of(Float) }
73
+ end
74
+
75
+ it "should not raise an error if no score is given by OpenCalais" do
76
+ lambda {Calais::Response.new(SAMPLE_RESPONSE_WITH_NO_SCORE)}.should_not raise_error
77
+ end
78
+
79
+ it "should not raise an error if no score is given by OpenCalais" do
80
+ response = Calais::Response.new(SAMPLE_RESPONSE_WITH_NO_SCORE)
81
+ response.categories.map {|c| c.score }.should == [nil]
82
+ end
83
+
84
+ it 'should find social tags' do
85
+ @response.socialtags.map {|c| c.name }.sort.should == ["Appropriate technology", "Bicycles", "Business_Finance", "Cycling", "Motorized bicycle", "Recreation", "Sustainability", "Sustainable transport", "Technology_Internet"]
86
+ end
87
+
88
+ it 'should have important scores associated with social tags' do
89
+ @response.socialtags.map {|c| c.importance.should be_a_kind_of(Integer) }
90
+ end
91
+
92
+
93
+ it 'should find instances for each entity' do
94
+ @response.entities.each {|e|
95
+ e.instances.size.should > 0
96
+ }
97
+ end
98
+
99
+
100
+ it 'should find instances for each relation' do
101
+ @response.relations.each {|r|
102
+ r.instances.size.should > 0
103
+ }
104
+ end
105
+
106
+ it 'should find the correct instances for each entity' do
107
+ ## This currently tests only for the "Australia" entity's
108
+ ## instances. A more thorough test that tests for the instances
109
+ ## of each of the many entities in the sample doc is desirable in
110
+ ## the future.
111
+
112
+ australia = @response.entities.select {|e| e.attributes["name"] == "Australia" }.first
113
+ australia.instances.size.should == 3
114
+ instances = australia.instances.sort{|a,b| a.offset <=> b.offset }
115
+
116
+ instances[0].prefix.should == "number of bicycles sold in "
117
+ instances[0].exact.should == "Australia"
118
+ instances[0].suffix.should == " in 2006<\/title>\n<date>January 4,"
119
+ instances[0].offset.should == 67
120
+ instances[0].length.should == 9
121
+
122
+ instances[1].prefix.should == "4, 2007<\/date>\n<body>\nBicycle sales in "
123
+ instances[1].exact.should == "Australia"
124
+ instances[1].suffix.should == " have recorded record sales of 1,273,781 units"
125
+ instances[1].offset.should == 146
126
+ instances[1].length.should == 9
127
+
128
+ instances[2].prefix.should == " the traditional company car,\" he said.\n\n\"Some of "
129
+ instances[2].exact.should == "Australia"
130
+ instances[2].suffix.should == "'s biggest corporations now have bicycle fleets,"
131
+ instances[2].offset.should == 952
132
+ instances[2].length.should == 9
133
+ end
134
+
135
+ it 'should find the correct instances for each relation' do
136
+ ## This currently tests only for one relation's instances. A more
137
+ ## thorough test that tests for the instances of each of the many other
138
+ ## relations in the sample doc is desirable in the future.
139
+
140
+ rel = @response.relations.select {|e| e.calais_hash.value == "8f3936d9-cf6b-37fc-ae0d-a145959ae3b5" }.first
141
+ rel.instances.size.should == 1
142
+
143
+ rel.instances.first.prefix.should == " manufacturers.\n\nThe Cycling Promotion Fund (CPF) "
144
+ rel.instances.first.exact.should == "spokesman Ian Christie said Australians were increasingly using bicycles as an alternative to cars."
145
+ rel.instances.first.suffix.should == " Sales rose nine percent in 2006 while the car"
146
+ rel.instances.first.offset.should == 425
147
+ rel.instances.first.length.should == 99
148
+ end
149
+ end
@@ -0,0 +1,538 @@
1
+ {
2
+ "doc":{
3
+ "info":{
4
+ "document":"<document>\n<id>57831</id>\n<title>Record number of bicycles sold in Australia in 2006</title>\n<date>January 4, 2007</date>\n<body>\nBicycle 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.\n\nThe 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.\n\nMr Christie, a native of Hobart, Tasmania 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.\n\n\"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.\"\n\n\"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.\"\n\nThe CPF claims most commutes to work are less than 5 kilometres (3 miles) making bicycle travel a viable alternative.\n\n</body></document>",
5
+ "docTitle":"Record number of bicycles sold in Australia in 2006",
6
+ "docDate":"2007-01-04 00:00:00",
7
+ "allowDistribution":"true",
8
+ "allowSearch":"true",
9
+ "calaisRequestID":"ede182ab-a3fc-4e96-9838-5fa73bccdea6",
10
+ "docRDFaccessible":"true",
11
+ "id":"http://id.opencalais.com/FYP3OZuxbUDyQEO42uKnqw"
12
+ },
13
+ "meta":{
14
+ "submitterCode":"4a388fbc-9897-def9-9233-efddbfbca363",
15
+ "signature":"digestalg-1|HhYSdHZifSUYvKGZpRu2xeoWlFE=|MPNwpbXJkJipQDb1lqyd/+X+Jd02mmtoCsOdLyLLTVCz0hKKBgDlOA==",
16
+ "contentType":"text/xml",
17
+ "emVer":"UserVocabulariesIM",
18
+ "langIdVer":"DefaultLangId",
19
+ "language":"English",
20
+ "processingVer":"CalaisJob01",
21
+ "submissionDate":"2009-06-08 16:29:07.040",
22
+ "messages":[
23
+
24
+ ]
25
+ }
26
+ },
27
+ "http://d.opencalais.com/dochash-1/9359fafb-1158-3343-91e3-7f4ed89f3b01/cat/1":{
28
+ "_typeGroup":"topics",
29
+ "category":"http://d.opencalais.com/cat/Calais/BusinessFinance",
30
+ "classifierName":"Calais",
31
+ "categoryName":"Business_Finance",
32
+ "score":0.916
33
+ },
34
+ "http://d.opencalais.com/dochash-1/9359fafb-1158-3343-91e3-7f4ed89f3b01/cat/2":{
35
+ "_typeGroup":"topics",
36
+ "category":"http://d.opencalais.com/cat/Calais/TechnologyInternet",
37
+ "classifierName":"Calais",
38
+ "categoryName":"Technology_Internet",
39
+ "score":0.736
40
+ },
41
+ "http://d.opencalais.com/genericHasher-1/84a34c48-25ac-327f-a805-7b81fd570f7d":{
42
+ "_type":"Country",
43
+ "_typeGroup":"entities",
44
+ "name":"Australia",
45
+ "instances":[
46
+ {
47
+ "detection":"[number of bicycles sold in ]Australia[ in 2006</title>\n<date>January 4,]",
48
+ "prefix":"number of bicycles sold in ",
49
+ "exact":"Australia",
50
+ "suffix":" in 2006</title>\n<date>January 4,",
51
+ "offset":67,
52
+ "length":9
53
+ },
54
+ {
55
+ "detection":"[4, 2007</date>\n<body>\nBicycle sales in ]Australia[ have recorded record sales of 1,273,781 units]",
56
+ "prefix":"4, 2007</date>\n<body>\nBicycle sales in ",
57
+ "exact":"Australia",
58
+ "suffix":" have recorded record sales of 1,273,781 units",
59
+ "offset":146,
60
+ "length":9
61
+ },
62
+ {
63
+ "detection":"[ the traditional company car,\" he said.\n\n\"Some of ]Australia['s biggest corporations now have bicycle fleets,]",
64
+ "prefix":" the traditional company car,\" he said.\n\n\"Some of ",
65
+ "exact":"Australia",
66
+ "suffix":"'s biggest corporations now have bicycle fleets,",
67
+ "offset":952,
68
+ "length":9
69
+ }
70
+ ],
71
+ "relevance":0.718,
72
+ "resolutions":[
73
+ {
74
+ "name":"Australia",
75
+ "shortname":"Australia",
76
+ "latitude":"-32.3456225086",
77
+ "longitude":"141.434598022"
78
+ }
79
+ ]
80
+ },
81
+ "http://d.opencalais.com/genericHasher-1/9853f11e-5efa-3efc-90b9-0d0450f7d673":{
82
+ "_type":"Organization",
83
+ "_typeGroup":"entities",
84
+ "name":"Cycling Promotion Fund",
85
+ "organizationtype":"N/A",
86
+ "nationality":"N/A",
87
+ "instances":[
88
+ {
89
+ "detection":"[yet to be realised by car manufacturers.\n\nThe ]Cycling Promotion Fund[ (CPF) spokesman Ian Christie said Australians]",
90
+ "prefix":"yet to be realised by car manufacturers.\n\nThe ",
91
+ "exact":"Cycling Promotion Fund",
92
+ "suffix":" (CPF) spokesman Ian Christie said Australians",
93
+ "offset":396,
94
+ "length":22
95
+ },
96
+ {
97
+ "detection":"[car manufacturers.\n\nThe Cycling Promotion Fund (]CPF[) spokesman Ian Christie said Australians were]",
98
+ "prefix":"car manufacturers.\n\nThe Cycling Promotion Fund (",
99
+ "exact":"CPF",
100
+ "suffix":") spokesman Ian Christie said Australians were",
101
+ "offset":420,
102
+ "length":3
103
+ },
104
+ {
105
+ "detection":"[of all cars sold are to company fleets.\"\n\nThe ]CPF[ claims most commutes to work are less than 5]",
106
+ "prefix":"of all cars sold are to company fleets.\"\n\nThe ",
107
+ "exact":"CPF",
108
+ "suffix":" claims most commutes to work are less than 5",
109
+ "offset":1318,
110
+ "length":3
111
+ }
112
+ ],
113
+ "relevance":0.506,
114
+ "resolutions":[
115
+
116
+ ]
117
+ },
118
+ "http://d.opencalais.com/genericHasher-1/d0ca04b6-9cf5-3595-ad4b-7758a0b57997":{
119
+ "_type":"ProvinceOrState",
120
+ "_typeGroup":"entities",
121
+ "name":"Tasmania",
122
+ "instances":[
123
+ {
124
+ "detection":"[ their fitness.\n\nMr Christie, a native of Hobart, ]Tasmania[ said organisations were beginning to supply]",
125
+ "prefix":" their fitness.\n\nMr Christie, a native of Hobart, ",
126
+ "exact":"Tasmania",
127
+ "suffix":" said organisations were beginning to supply",
128
+ "offset":709,
129
+ "length":8
130
+ }
131
+ ],
132
+ "relevance":0.168,
133
+ "resolutions":[
134
+ {
135
+ "name":"Tasmania,Australia",
136
+ "shortname":"Tasmania",
137
+ "containedbycountry":"Australia",
138
+ "latitude":"-42",
139
+ "longitude":"147"
140
+ }
141
+ ]
142
+ },
143
+ "http://d.opencalais.com/genericHasher-1/4883e991-e7a0-3881-8e5a-b23ede61544e":{
144
+ "_type":"Quotation",
145
+ "_typeGroup":"relations",
146
+ "person":"http://d.opencalais.com/pershash-1/3bcf2655-ff2a-3a80-8de4-558b9626ad21",
147
+ "quote":"There is an emerging trend towards people using bikes as their official company-supplied vehicle in place of the traditional company car; 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.",
148
+ "instances":[
149
+ {
150
+ "detection":"[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.\n\n\"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.\"[\n\n\"Although the company bicycle is a long way]",
151
+ "prefix":"to supply bicycles as a company vehicle. ",
152
+ "exact":"\"There is an emerging trend towards people using bikes as their official company-supplied vehicle in place of the traditional company car,\" he said.\n\n\"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.\"",
153
+ "suffix":"\n\n\"Although the company bicycle is a long way",
154
+ "offset":793,
155
+ "length":335
156
+ }
157
+ ]
158
+ },
159
+ "http://d.opencalais.com/genericHasher-1/0c3d5340-106f-390e-92d3-a4aa18004fb8":{
160
+ "_type":"IndustryTerm",
161
+ "_typeGroup":"entities",
162
+ "name":"company car",
163
+ "instances":[
164
+ {
165
+ "detection":"[company-supplied vehicle in place of the ]traditional company car[,\" he said.\n\n\"Some of Australia's biggest]",
166
+ "prefix":"company-supplied vehicle in place of the ",
167
+ "exact":"traditional company car",
168
+ "suffix":",\" he said.\n\n\"Some of Australia's biggest",
169
+ "offset":907,
170
+ "length":23
171
+ },
172
+ {
173
+ "detection":"[bicycle is a long way from taking over from the ]company car[, it's an important trend when you consider that]",
174
+ "prefix":"bicycle is a long way from taking over from the ",
175
+ "exact":"company car",
176
+ "suffix":", it's an important trend when you consider that",
177
+ "offset":1200,
178
+ "length":11
179
+ }
180
+ ],
181
+ "relevance":0.186,
182
+ "resolutions":[
183
+
184
+ ]
185
+ },
186
+ "http://d.opencalais.com/pershash-1/3bcf2655-ff2a-3a80-8de4-558b9626ad21":{
187
+ "_type":"Person",
188
+ "_typeGroup":"entities",
189
+ "name":"Ian Christie",
190
+ "persontype":"political",
191
+ "nationality":"N/A",
192
+ "instances":[
193
+ {
194
+ "detection":"[Cycling Promotion Fund (CPF) spokesman ]Ian Christie[ said Australians were increasingly using]",
195
+ "prefix":"Cycling Promotion Fund (CPF) spokesman ",
196
+ "exact":"Ian Christie",
197
+ "suffix":" said Australians were increasingly using",
198
+ "offset":435,
199
+ "length":12
200
+ },
201
+ {
202
+ "detection":"[percent in 2006 while the car market stalled. ]Mr Christie[ said people were looking to cut their fuel costs]",
203
+ "prefix":"percent in 2006 while the car market stalled. ",
204
+ "exact":"Mr Christie",
205
+ "suffix":" said people were looking to cut their fuel costs",
206
+ "offset":587,
207
+ "length":11
208
+ },
209
+ {
210
+ "detection":"[ cut their fuel costs and improve their fitness.\n\n]Mr Christie[, a native of Hobart, Tasmania said organisations]",
211
+ "prefix":" cut their fuel costs and improve their fitness.\n\n",
212
+ "exact":"Mr Christie",
213
+ "suffix":", a native of Hobart, Tasmania said organisations",
214
+ "offset":676,
215
+ "length":11
216
+ },
217
+ {
218
+ "detection":"[in place of the traditional company car,\" ]he[ said.\n\n\"Some of Australia's biggest corporations]",
219
+ "prefix":"in place of the traditional company car,\" ",
220
+ "exact":"he",
221
+ "suffix":" said.\n\n\"Some of Australia's biggest corporations",
222
+ "offset":933,
223
+ "length":2
224
+ }
225
+ ],
226
+ "relevance":0.568,
227
+ "resolutions":[
228
+
229
+ ]
230
+ },
231
+ "http://d.opencalais.com/genericHasher-1/aad05e63-b79e-33cc-9c1a-385b47072694":{
232
+ "_type":"Quotation",
233
+ "_typeGroup":"relations",
234
+ "person":"http://d.opencalais.com/pershash-1/3bcf2655-ff2a-3a80-8de4-558b9626ad21",
235
+ "quote":"people were looking to cut their fuel costs and improve their fitness",
236
+ "instances":[
237
+ {
238
+ "detection":"[percent in 2006 while the car market stalled. ]Mr Christie said people were looking to cut their fuel costs and improve their fitness.[\n\nMr Christie, a native of Hobart, Tasmania said]",
239
+ "prefix":"percent in 2006 while the car market stalled. ",
240
+ "exact":"Mr Christie said people were looking to cut their fuel costs and improve their fitness.",
241
+ "suffix":"\n\nMr Christie, a native of Hobart, Tasmania said",
242
+ "offset":587,
243
+ "length":87
244
+ }
245
+ ]
246
+ },
247
+ "http://d.opencalais.com/genericHasher-1/17126376-4538-3f7d-b31d-bcb2c6472493":{
248
+ "_type":"Position",
249
+ "_typeGroup":"entities",
250
+ "name":"spokesman ",
251
+ "instances":[
252
+ {
253
+ "detection":"[ manufacturers.\n\nThe Cycling Promotion Fund (CPF) ]spokesman[ Ian Christie said Australians were increasingly]",
254
+ "prefix":" manufacturers.\n\nThe Cycling Promotion Fund (CPF) ",
255
+ "exact":"spokesman",
256
+ "suffix":" Ian Christie said Australians were increasingly",
257
+ "offset":425,
258
+ "length":9
259
+ }
260
+ ],
261
+ "relevance":0.275,
262
+ "resolutions":[
263
+
264
+ ]
265
+ },
266
+ "http://d.opencalais.com/genericHasher-1/79d73227-2f18-3014-8dc6-81a29851ea5d":{
267
+ "_type":"GenericRelations",
268
+ "_typeGroup":"relations",
269
+ "verb":"realize",
270
+ "relationsubject":"http://d.opencalais.com/genericHasher-1/ed0e83f9-87e8-3da6-ab46-cd6be116357c",
271
+ "relationobject":"a figure",
272
+ "instances":[
273
+ {
274
+ "detection":"[industry has sold more than one million units, ]a figure yet to be realised by car manufacturers[.\n\nThe Cycling Promotion Fund (CPF) spokesman Ian]",
275
+ "prefix":"industry has sold more than one million units, ",
276
+ "exact":"a figure yet to be realised by car manufacturers",
277
+ "suffix":".\n\nThe Cycling Promotion Fund (CPF) spokesman Ian",
278
+ "offset":341,
279
+ "length":48
280
+ }
281
+ ]
282
+ },
283
+ "http://d.opencalais.com/genericHasher-1/d2bc3216-c3e9-33ee-bb14-675cd80e00ce":{
284
+ "_type":"Quotation",
285
+ "_typeGroup":"relations",
286
+ "person":"http://d.opencalais.com/pershash-1/3bcf2655-ff2a-3a80-8de4-558b9626ad21",
287
+ "quote":"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.",
288
+ "instances":[
289
+ {
290
+ "detection":"[organisations which operate fleets of bikes.\"\n\n]\"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.\"[\n\nThe CPF claims most commutes to work are less]",
291
+ "prefix":"organisations which operate fleets of bikes.\"\n\n",
292
+ "exact":"\"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.\"",
293
+ "suffix":"\n\nThe CPF claims most commutes to work are less",
294
+ "offset":1130,
295
+ "length":182
296
+ }
297
+ ]
298
+ },
299
+ "http://d.opencalais.com/genericHasher-1/8f3936d9-cf6b-37fc-ae0d-a145959ae3b5":{
300
+ "_type":"GenericRelations",
301
+ "_typeGroup":"relations",
302
+ "verb":"say",
303
+ "relationsubject":"http://d.opencalais.com/pershash-1/3bcf2655-ff2a-3a80-8de4-558b9626ad21",
304
+ "relationobject":"Australians were increasingly using bicycles as an alternative to cars",
305
+ "instances":[
306
+ {
307
+ "detection":"[ manufacturers.\n\nThe 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]",
308
+ "prefix":" manufacturers.\n\nThe Cycling Promotion Fund (CPF) ",
309
+ "exact":"spokesman Ian Christie said Australians were increasingly using bicycles as an alternative to cars.",
310
+ "suffix":" Sales rose nine percent in 2006 while the car",
311
+ "offset":425,
312
+ "length":99
313
+ }
314
+ ]
315
+ },
316
+ "http://d.opencalais.com/genericHasher-1/9fa3fb8a-f517-32c7-8a46-3c1506ea3a70":{
317
+ "_type":"City",
318
+ "_typeGroup":"entities",
319
+ "name":"Hobart",
320
+ "instances":[
321
+ {
322
+ "detection":"[ improve their fitness.\n\nMr Christie, a native of ]Hobart[, Tasmania said organisations were beginning to]",
323
+ "prefix":" improve their fitness.\n\nMr Christie, a native of ",
324
+ "exact":"Hobart",
325
+ "suffix":", Tasmania said organisations were beginning to",
326
+ "offset":701,
327
+ "length":6
328
+ }
329
+ ],
330
+ "relevance":0.168,
331
+ "resolutions":[
332
+ {
333
+ "name":"Hobart,Tasmania,Australia",
334
+ "shortname":"Hobart",
335
+ "containedbystate":"Tasmania",
336
+ "containedbycountry":"Australia",
337
+ "latitude":"-42.8806",
338
+ "longitude":"147.325"
339
+ }
340
+ ]
341
+ },
342
+ "http://d.opencalais.com/genericHasher-1/acc62eba-98d2-3481-9e2c-fb775f7e01f3":{
343
+ "_type":"GenericRelations",
344
+ "_typeGroup":"relations",
345
+ "verb":"say",
346
+ "relationsubject":"http://d.opencalais.com/genericHasher-1/d0ca04b6-9cf5-3595-ad4b-7758a0b57997",
347
+ "relationobject":"organisations were beginning to supply bicycles as a company vehicle",
348
+ "instances":[
349
+ {
350
+ "detection":"[ their fitness.\n\nMr Christie, a native of Hobart, ]Tasmania said organisations were beginning to supply bicycles as a company vehicle.[ \"There is an emerging trend towards people using]",
351
+ "prefix":" their fitness.\n\nMr Christie, a native of Hobart, ",
352
+ "exact":"Tasmania said organisations were beginning to supply bicycles as a company vehicle.",
353
+ "suffix":" \"There is an emerging trend towards people using",
354
+ "offset":709,
355
+ "length":83
356
+ }
357
+ ]
358
+ },
359
+ "http://d.opencalais.com/genericHasher-1/d12ca52d-e0ec-3458-839d-4b6a69d3db33":{
360
+ "_type":"PersonCareer",
361
+ "_typeGroup":"relations",
362
+ "person":"http://d.opencalais.com/pershash-1/3bcf2655-ff2a-3a80-8de4-558b9626ad21",
363
+ "position":"http://d.opencalais.com/genericHasher-1/17126376-4538-3f7d-b31d-bcb2c6472493",
364
+ "organization":"http://d.opencalais.com/genericHasher-1/9853f11e-5efa-3efc-90b9-0d0450f7d673",
365
+ "careertype":"professional",
366
+ "status":"current",
367
+ "instances":[
368
+ {
369
+ "detection":"[yet to be realised by car manufacturers.\n\nThe ]Cycling Promotion Fund (CPF) spokesman Ian Christie[ said Australians were increasingly using]",
370
+ "prefix":"yet to be realised by car manufacturers.\n\nThe ",
371
+ "exact":"Cycling Promotion Fund (CPF) spokesman Ian Christie",
372
+ "suffix":" said Australians were increasingly using",
373
+ "offset":396,
374
+ "length":51
375
+ }
376
+ ]
377
+ },
378
+ "http://d.opencalais.com/genericHasher-1/ed0e83f9-87e8-3da6-ab46-cd6be116357c":{
379
+ "_type":"IndustryTerm",
380
+ "_typeGroup":"entities",
381
+ "name":"car manufacturers",
382
+ "instances":[
383
+ {
384
+ "detection":"[million units, a figure yet to be realised by ]car manufacturers[.\n\nThe Cycling Promotion Fund (CPF) spokesman Ian]",
385
+ "prefix":"million units, a figure yet to be realised by ",
386
+ "exact":"car manufacturers",
387
+ "suffix":".\n\nThe Cycling Promotion Fund (CPF) spokesman Ian",
388
+ "offset":372,
389
+ "length":17
390
+ }
391
+ ],
392
+ "relevance":0.303,
393
+ "resolutions":[
394
+
395
+ ]
396
+ },
397
+ "http://d.opencalais.com/genericHasher-1/e05f3d33-1622-3172-836c-b48637a156d3":{
398
+ "_type":"Continent",
399
+ "_typeGroup":"entities",
400
+ "name":"Australia",
401
+ "instances":[
402
+ {
403
+ "detection":"[number of bicycles sold in ]Australia[ in 2006</title>\n<date>January 4,]",
404
+ "prefix":"number of bicycles sold in ",
405
+ "exact":"Australia",
406
+ "suffix":" in 2006</title>\n<date>January 4,",
407
+ "offset":67,
408
+ "length":9
409
+ }
410
+ ],
411
+ "relevance":0.328,
412
+ "resolutions":[
413
+
414
+ ]
415
+ },
416
+ "http://d.opencalais.com/genericHasher-1/0bb9cdb4-3cb7-342a-9901-6d1f12b32f6a":{
417
+ "_type":"IndustryTerm",
418
+ "_typeGroup":"entities",
419
+ "name":"car sales",
420
+ "instances":[
421
+ {
422
+ "detection":"[sales of 1,273,781 units for 2006, exceeding ]car sales[ by 32 percent. It is the fifth year in a row]",
423
+ "prefix":"sales of 1,273,781 units for 2006, exceeding ",
424
+ "exact":"car sales",
425
+ "suffix":" by 32 percent. It is the fifth year in a row",
426
+ "offset":222,
427
+ "length":9
428
+ }
429
+ ],
430
+ "relevance":0.322,
431
+ "resolutions":[
432
+
433
+ ]
434
+ },
435
+ "http://d.opencalais.com/genericHasher-1/3979e581-0823-3e84-9257-1ca36db4665e":{
436
+ "_type":"IndustryTerm",
437
+ "_typeGroup":"entities",
438
+ "name":"car market",
439
+ "instances":[
440
+ {
441
+ "detection":"[cars. Sales rose nine percent in 2006 while the ]car market[ stalled. Mr Christie said people were looking to]",
442
+ "prefix":"cars. Sales rose nine percent in 2006 while the ",
443
+ "exact":"car market",
444
+ "suffix":" stalled. Mr Christie said people were looking to",
445
+ "offset":567,
446
+ "length":10
447
+ }
448
+ ],
449
+ "relevance":0.254,
450
+ "resolutions":[
451
+
452
+ ]
453
+ },
454
+ "http://d.opencalais.com/genericHasher-1/c2ec763e-020f-3efa-91da-943e6eaae794":{
455
+ "_type":"Quotation",
456
+ "_typeGroup":"relations",
457
+ "person":"http://d.opencalais.com/pershash-1/3bcf2655-ff2a-3a80-8de4-558b9626ad21",
458
+ "quote":"organisations were beginning to supply bicycles as a company vehicle",
459
+ "instances":[
460
+ {
461
+ "detection":"[ cut their fuel costs and improve their fitness.\n\n]Mr Christie, a native of Hobart, Tasmania said organisations were beginning to supply bicycles as a company vehicle.[ \"There is an emerging trend towards people using]",
462
+ "prefix":" cut their fuel costs and improve their fitness.\n\n",
463
+ "exact":"Mr Christie, a native of Hobart, Tasmania said organisations were beginning to supply bicycles as a company vehicle.",
464
+ "suffix":" \"There is an emerging trend towards people using",
465
+ "offset":676,
466
+ "length":116
467
+ }
468
+ ]
469
+ },
470
+ "http://d.opencalais.com/genericHasher-1/c02271aa-0d63-3f49-89ba-9ebdd5cbd0ee":{
471
+ "_type":"PersonAttributes",
472
+ "_typeGroup":"relations",
473
+ "person":"http://d.opencalais.com/pershash-1/3bcf2655-ff2a-3a80-8de4-558b9626ad21",
474
+ "birthplace":"Hobart",
475
+ "birthplacetype":"City",
476
+ "gender":"M",
477
+ "instances":[
478
+ {
479
+ "detection":"[ cut their fuel costs and improve their fitness.\n\n]Mr Christie, a native of Hobart, Tasmania[ said organisations were beginning to supply]",
480
+ "prefix":" cut their fuel costs and improve their fitness.\n\n",
481
+ "exact":"Mr Christie, a native of Hobart, Tasmania",
482
+ "suffix":" said organisations were beginning to supply",
483
+ "offset":676,
484
+ "length":41
485
+ }
486
+ ]
487
+ },
488
+ "http://d.opencalais.com/genericHasher-1/d0dd2309-76eb-3679-a37f-edcfcb30513d":{
489
+ "_type":"Quotation",
490
+ "_typeGroup":"relations",
491
+ "person":"http://d.opencalais.com/pershash-1/3bcf2655-ff2a-3a80-8de4-558b9626ad21",
492
+ "persondescription":"spokesman, Cycling Promotion Fund",
493
+ "quote":"Australians were increasingly using bicycles as an alternative to cars",
494
+ "instances":[
495
+ {
496
+ "detection":"[ figure yet to be realised by car manufacturers.\n\n]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]",
497
+ "prefix":" figure yet to be realised by car manufacturers.\n\n",
498
+ "exact":"The Cycling Promotion Fund (CPF) spokesman Ian Christie said Australians were increasingly using bicycles as an alternative to cars.",
499
+ "suffix":" Sales rose nine percent in 2006 while the car",
500
+ "offset":392,
501
+ "length":132
502
+ }
503
+ ]
504
+ },
505
+ "http://d.opencalais.com/genericHasher-1/21431161-7b9f-34c0-9417-9f9b72ed8a70":{
506
+ "_type":"GenericRelations",
507
+ "_typeGroup":"relations",
508
+ "verb":"say",
509
+ "relationsubject":"http://d.opencalais.com/pershash-1/3bcf2655-ff2a-3a80-8de4-558b9626ad21",
510
+ "relationobject":"people were looking to cut their fuel costs and improve their fitness",
511
+ "instances":[
512
+ {
513
+ "detection":"[percent in 2006 while the car market stalled. ]Mr Christie said people were looking to cut their fuel costs and improve their fitness.[\n\nMr Christie, a native of Hobart, Tasmania said]",
514
+ "prefix":"percent in 2006 while the car market stalled. ",
515
+ "exact":"Mr Christie said people were looking to cut their fuel costs and improve their fitness.",
516
+ "suffix":"\n\nMr Christie, a native of Hobart, Tasmania said",
517
+ "offset":587,
518
+ "length":87
519
+ }
520
+ ]
521
+ },
522
+ "http://d.opencalais.com/genericHasher-1/03ebb542-58cd-346f-8cf5-c69cfef1d446":{
523
+ "_type":"GenericRelations",
524
+ "_typeGroup":"relations",
525
+ "verb":"stall",
526
+ "relationsubject":"http://d.opencalais.com/genericHasher-1/3979e581-0823-3e84-9257-1ca36db4665e",
527
+ "instances":[
528
+ {
529
+ "detection":"[to cars. Sales rose nine percent in 2006 while ]the car market stalled[. Mr Christie said people were looking to cut]",
530
+ "prefix":"to cars. Sales rose nine percent in 2006 while ",
531
+ "exact":"the car market stalled",
532
+ "suffix":". Mr Christie said people were looking to cut",
533
+ "offset":563,
534
+ "length":22
535
+ }
536
+ ]
537
+ }
538
+ }