documentcloud 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +45 -1
- data/lib/document_cloud/api/destroy.rb +2 -2
- data/lib/document_cloud/api/document.rb +2 -2
- data/lib/document_cloud/api/entities.rb +2 -2
- data/lib/document_cloud/api/projects.rb +2 -2
- data/lib/document_cloud/api/update.rb +2 -2
- data/lib/document_cloud/api/update_project.rb +2 -2
- data/lib/document_cloud/version.rb +1 -1
- metadata +6 -13
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 85624f45e49e63cca8533313979668d61170ff70
|
4
|
+
data.tar.gz: 8262d41db09bac2fed94a9f9e3fc1452ffa99323
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 367417f221e27d26c82dae344bed4a1a791df1dc113bea75a4a1b76f424ca4e998a378a5b63dc1309b1c1fbc555d4f4bf8766f0fd2c611d889d2848aa89495ed
|
7
|
+
data.tar.gz: df90ed5492641788f203b12406173c9cfcf350815598aae63d25a8057087495063344285f3c3633c204fb1a6202a51217d52ec1798c0db1b201a4a11c5e170ad
|
data/README.md
CHANGED
@@ -81,6 +81,7 @@ doc.print_annotations
|
|
81
81
|
doc.related_article
|
82
82
|
doc.text # Raw parsed text from document
|
83
83
|
doc.thumbnail # Primary thumbnail of document
|
84
|
+
doc.entities # Returns a hash of entities and their relevance
|
84
85
|
|
85
86
|
# Images
|
86
87
|
doc.image(page, size) # Returns the image of a page at the specified size
|
@@ -102,8 +103,51 @@ results.documents # Array of documents of results:
|
|
102
103
|
results.documents[0].title # First result title
|
103
104
|
```
|
104
105
|
|
106
|
+
### Projects
|
107
|
+
Projects returns an array of Project objects which contain a list of Documents and
|
108
|
+
metadata about the project.
|
109
|
+
|
110
|
+
```ruby
|
111
|
+
projects = DocumentCloud.projects
|
112
|
+
|
113
|
+
project = projects.first
|
114
|
+
|
115
|
+
# Accessors
|
116
|
+
project.id
|
117
|
+
project.title
|
118
|
+
project.description
|
119
|
+
project.documents # Returns an array of Document objects
|
120
|
+
```
|
121
|
+
|
122
|
+
### Entities
|
123
|
+
Entities takes a document id and returns a hash of entities, which
|
124
|
+
include a value and relevance for each type of entity.
|
125
|
+
|
126
|
+
```ruby
|
127
|
+
entities = DocumentCloud.entities(2072158)
|
128
|
+
|
129
|
+
# example output
|
130
|
+
{
|
131
|
+
:person=>[{:value=>"Pita Sharples", :relevance=>0.112}],
|
132
|
+
:organization=>[{:value=>"Māori Party", :relevance=>0.48}],
|
133
|
+
:place=>[],
|
134
|
+
:term=>
|
135
|
+
[{:value=>"finance costs", :relevance=>0.552},
|
136
|
+
{:value=>"public services", :relevance=>0.526}],
|
137
|
+
:email=>[],
|
138
|
+
:phone=>[],
|
139
|
+
:city=>[],
|
140
|
+
:state=>[],
|
141
|
+
:country=>
|
142
|
+
[{:value=>"New Zealand", :relevance=>0.628},
|
143
|
+
{:value=>"Australia", :relevance=>0.302},
|
144
|
+
{:value=>"United States", :relevance=>0.295},
|
145
|
+
{:value=>"United Kingdom", :relevance=>0.295},
|
146
|
+
{:value=>"China", :relevance=>0.294}]
|
147
|
+
}
|
148
|
+
```
|
105
149
|
|
106
150
|
|
107
151
|
## Information
|
108
152
|
|
109
|
-
DocumentCloud API info: http://www.documentcloud.org/help/api
|
153
|
+
DocumentCloud API info: http://www.documentcloud.org/help/api
|
@@ -6,10 +6,10 @@ module DocumentCloud
|
|
6
6
|
|
7
7
|
# List projects
|
8
8
|
#
|
9
|
-
# @returns [
|
9
|
+
# @returns [DocumentCloud::Project] An array of fetched project entities
|
10
10
|
def projects
|
11
11
|
build_objects DocumentCloud::Project, get(PROJECTS_PATH)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
15
|
-
end
|
15
|
+
end
|
@@ -2,7 +2,7 @@ module DocumentCloud
|
|
2
2
|
class Version
|
3
3
|
MAJOR = 0 unless defined? DocumentCloud::Version::MAJOR
|
4
4
|
MINOR = 3 unless defined? DocumentCloud::Version::MINOR
|
5
|
-
PATCH =
|
5
|
+
PATCH = 2 unless defined? DocumentCloud::Version::PATCH
|
6
6
|
PRE = nil unless defined? DocumentCloud::Version::PRE
|
7
7
|
|
8
8
|
class << self
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: documentcloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
5
|
-
prerelease:
|
4
|
+
version: 0.3.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Miles Zimmerman
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2016-02-18 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rest-client
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - "~>"
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,7 +27,6 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: multi_json
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - "~>"
|
36
32
|
- !ruby/object:Gem::Version
|
@@ -38,7 +34,6 @@ dependencies:
|
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - "~>"
|
44
39
|
- !ruby/object:Gem::Version
|
@@ -53,6 +48,7 @@ files:
|
|
53
48
|
- LICENSE
|
54
49
|
- README.md
|
55
50
|
- documentcloud.gemspec
|
51
|
+
- lib/document_cloud.rb
|
56
52
|
- lib/document_cloud/api/create_project.rb
|
57
53
|
- lib/document_cloud/api/destroy.rb
|
58
54
|
- lib/document_cloud/api/document.rb
|
@@ -70,32 +66,29 @@ files:
|
|
70
66
|
- lib/document_cloud/project.rb
|
71
67
|
- lib/document_cloud/search_results.rb
|
72
68
|
- lib/document_cloud/version.rb
|
73
|
-
- lib/document_cloud.rb
|
74
69
|
- lib/documentcloud.rb
|
75
70
|
homepage: https://github.com/mileszim/documentcloud
|
76
71
|
licenses:
|
77
72
|
- MIT
|
73
|
+
metadata: {}
|
78
74
|
post_install_message:
|
79
75
|
rdoc_options: []
|
80
76
|
require_paths:
|
81
77
|
- lib
|
82
78
|
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
-
none: false
|
84
79
|
requirements:
|
85
80
|
- - ">="
|
86
81
|
- !ruby/object:Gem::Version
|
87
82
|
version: '0'
|
88
83
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
84
|
requirements:
|
91
85
|
- - ">="
|
92
86
|
- !ruby/object:Gem::Version
|
93
87
|
version: '0'
|
94
88
|
requirements: []
|
95
89
|
rubyforge_project:
|
96
|
-
rubygems_version:
|
90
|
+
rubygems_version: 2.5.1
|
97
91
|
signing_key:
|
98
|
-
specification_version:
|
92
|
+
specification_version: 4
|
99
93
|
summary: Rubygem for interacting with the DocumentCloud API
|
100
94
|
test_files: []
|
101
|
-
has_rdoc:
|