mindee 3.5.0 → 3.6.1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/README.md +39 -4
- data/bin/mindee.rb +6 -0
- data/docs/bank_account_details_v2.md +1 -1
- data/docs/bank_check_v1.md +1 -1
- data/docs/bank_statement_fr_v1.md +1 -1
- data/docs/barcode_reader_v1.md +1 -1
- data/docs/carte_grise_v1.md +1 -1
- data/docs/carte_vitale_v1.md +1 -1
- data/docs/code_samples/resume_v1_async.txt +19 -0
- data/docs/cropper_v1.md +1 -1
- data/docs/custom_v1.md +1 -1
- data/docs/eu_driver_license_v1.md +5 -5
- data/docs/expense_receipts_v5.md +1 -1
- data/docs/financial_document_v1.md +1 -1
- data/docs/generated_v1.md +1 -1
- data/docs/getting_started.md +1 -1
- data/docs/idcard_fr_v2.md +1 -1
- data/docs/international_id_v2.md +226 -0
- data/docs/invoice_splitter_v1.md +1 -1
- data/docs/invoices_v4.md +1 -1
- data/docs/license_plates_v1.md +1 -1
- data/docs/multi_receipts_detector_v1.md +1 -1
- data/docs/passport_v1.md +1 -1
- data/docs/proof_of_address_v1.md +1 -1
- data/docs/resume_v1.md +334 -0
- data/docs/us_driver_license_v1.md +1 -1
- data/docs/us_w9_v1.md +1 -1
- data/lib/mindee/http/endpoint.rb +24 -17
- data/lib/mindee/http/error.rb +11 -4
- data/lib/mindee/http/response_validation.rb +56 -0
- data/lib/mindee/parsing/common/api_response.rb +6 -1
- data/lib/mindee/parsing/standard/base_field.rb +1 -1
- data/lib/mindee/product/.rubocop.yml +7 -2
- data/lib/mindee/product/eu/driver_license/driver_license_v1.rb +2 -2
- data/lib/mindee/product/eu/driver_license/driver_license_v1_document.rb +1 -1
- data/lib/mindee/product/eu/driver_license/driver_license_v1_page.rb +2 -2
- data/lib/mindee/product/fr/carte_grise/carte_grise_v1_document.rb +0 -2
- data/lib/mindee/product/resume/resume_v1.rb +39 -0
- data/lib/mindee/product/resume/resume_v1_certificate.rb +69 -0
- data/lib/mindee/product/resume/resume_v1_document.rb +322 -0
- data/lib/mindee/product/resume/resume_v1_education.rb +90 -0
- data/lib/mindee/product/resume/resume_v1_language.rb +55 -0
- data/lib/mindee/product/resume/resume_v1_page.rb +32 -0
- data/lib/mindee/product/resume/resume_v1_professional_experience.rb +97 -0
- data/lib/mindee/product/resume/resume_v1_social_networks_url.rb +55 -0
- data/lib/mindee/product.rb +1 -0
- data/lib/mindee/version.rb +1 -1
- metadata +14 -2
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../../parsing'
|
4
|
+
require_relative 'resume_v1_document'
|
5
|
+
require_relative 'resume_v1_page'
|
6
|
+
|
7
|
+
module Mindee
|
8
|
+
module Product
|
9
|
+
# Resume module.
|
10
|
+
module Resume
|
11
|
+
# Resume V1 prediction inference.
|
12
|
+
class ResumeV1 < Mindee::Parsing::Common::Inference
|
13
|
+
@endpoint_name = 'resume'
|
14
|
+
@endpoint_version = '1'
|
15
|
+
|
16
|
+
# @param prediction [Hash]
|
17
|
+
def initialize(prediction)
|
18
|
+
super
|
19
|
+
@prediction = ResumeV1Document.new(prediction['prediction'], nil)
|
20
|
+
@pages = []
|
21
|
+
prediction['pages'].each do |page|
|
22
|
+
if page.key?('prediction') && !page['prediction'].nil? && !page['prediction'].empty?
|
23
|
+
@pages.push(ResumeV1Page.new(page))
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
class << self
|
29
|
+
# Name of the endpoint for this product.
|
30
|
+
# @return [String]
|
31
|
+
attr_reader :endpoint_name
|
32
|
+
# Version for this product.
|
33
|
+
# @return [String]
|
34
|
+
attr_reader :endpoint_version
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../../parsing'
|
4
|
+
|
5
|
+
module Mindee
|
6
|
+
module Product
|
7
|
+
module Resume
|
8
|
+
# The list of certificates obtained by the candidate.
|
9
|
+
class ResumeV1Certificate < Mindee::Parsing::Standard::FeatureField
|
10
|
+
include Mindee::Parsing::Standard
|
11
|
+
# The grade obtained for the certificate.
|
12
|
+
# @return [String]
|
13
|
+
attr_reader :grade
|
14
|
+
# The name of certification.
|
15
|
+
# @return [String]
|
16
|
+
attr_reader :name
|
17
|
+
# The organization or institution that issued the certificate.
|
18
|
+
# @return [String]
|
19
|
+
attr_reader :provider
|
20
|
+
# The year when a certificate was issued or received.
|
21
|
+
# @return [String]
|
22
|
+
attr_reader :year
|
23
|
+
|
24
|
+
# @param prediction [Hash]
|
25
|
+
# @param page_id [Integer, nil]
|
26
|
+
def initialize(prediction, page_id)
|
27
|
+
super(prediction, page_id)
|
28
|
+
@grade = prediction['grade']
|
29
|
+
@name = prediction['name']
|
30
|
+
@provider = prediction['provider']
|
31
|
+
@year = prediction['year']
|
32
|
+
@page_id = page_id
|
33
|
+
end
|
34
|
+
|
35
|
+
# @return [Hash]
|
36
|
+
def printable_values
|
37
|
+
printable = {}
|
38
|
+
printable[:grade] = format_for_display(@grade, 10)
|
39
|
+
printable[:name] = format_for_display(@name, 30)
|
40
|
+
printable[:provider] = format_for_display(@provider, 25)
|
41
|
+
printable[:year] = format_for_display(@year, nil)
|
42
|
+
printable
|
43
|
+
end
|
44
|
+
|
45
|
+
# @return [String]
|
46
|
+
def to_table_line
|
47
|
+
printable = printable_values
|
48
|
+
out_str = String.new
|
49
|
+
out_str << format('| %- 11s', printable[:grade])
|
50
|
+
out_str << format('| %- 31s', printable[:name])
|
51
|
+
out_str << format('| %- 26s', printable[:provider])
|
52
|
+
out_str << format('| %- 5s', printable[:year])
|
53
|
+
out_str << '|'
|
54
|
+
end
|
55
|
+
|
56
|
+
# @return [String]
|
57
|
+
def to_s
|
58
|
+
printable = printable_values
|
59
|
+
out_str = String.new
|
60
|
+
out_str << "\n :Grade: #{printable[:grade]}"
|
61
|
+
out_str << "\n :Name: #{printable[:name]}"
|
62
|
+
out_str << "\n :Provider: #{printable[:provider]}"
|
63
|
+
out_str << "\n :Year: #{printable[:year]}"
|
64
|
+
out_str
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,322 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../../parsing'
|
4
|
+
require_relative 'resume_v1_social_networks_url'
|
5
|
+
require_relative 'resume_v1_language'
|
6
|
+
require_relative 'resume_v1_education'
|
7
|
+
require_relative 'resume_v1_professional_experience'
|
8
|
+
require_relative 'resume_v1_certificate'
|
9
|
+
|
10
|
+
module Mindee
|
11
|
+
module Product
|
12
|
+
module Resume
|
13
|
+
# Resume V1 document prediction.
|
14
|
+
class ResumeV1Document < Mindee::Parsing::Common::Prediction
|
15
|
+
include Mindee::Parsing::Standard
|
16
|
+
# The location information of the candidate, including city, state, and country.
|
17
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
18
|
+
attr_reader :address
|
19
|
+
# The list of certificates obtained by the candidate.
|
20
|
+
# @return [Array<Mindee::Product::Resume::ResumeV1Certificate>]
|
21
|
+
attr_reader :certificates
|
22
|
+
# The ISO 639 code of the language in which the document is written.
|
23
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
24
|
+
attr_reader :document_language
|
25
|
+
# The type of the document sent.
|
26
|
+
# @return [Mindee::Parsing::Standard::ClassificationField]
|
27
|
+
attr_reader :document_type
|
28
|
+
# The list of the candidate's educational background.
|
29
|
+
# @return [Array<Mindee::Product::Resume::ResumeV1Education>]
|
30
|
+
attr_reader :education
|
31
|
+
# The email address of the candidate.
|
32
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
33
|
+
attr_reader :email_address
|
34
|
+
# The candidate's first or given names.
|
35
|
+
# @return [Array<Mindee::Parsing::Standard::StringField>]
|
36
|
+
attr_reader :given_names
|
37
|
+
# The list of the candidate's technical abilities and knowledge.
|
38
|
+
# @return [Array<Mindee::Parsing::Standard::StringField>]
|
39
|
+
attr_reader :hard_skills
|
40
|
+
# The position that the candidate is applying for.
|
41
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
42
|
+
attr_reader :job_applied
|
43
|
+
# The list of languages that the candidate is proficient in.
|
44
|
+
# @return [Array<Mindee::Product::Resume::ResumeV1Language>]
|
45
|
+
attr_reader :languages
|
46
|
+
# The ISO 3166 code for the country of citizenship of the candidate.
|
47
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
48
|
+
attr_reader :nationality
|
49
|
+
# The phone number of the candidate.
|
50
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
51
|
+
attr_reader :phone_number
|
52
|
+
# The candidate's current profession.
|
53
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
54
|
+
attr_reader :profession
|
55
|
+
# The list of the candidate's professional experiences.
|
56
|
+
# @return [Array<Mindee::Product::Resume::ResumeV1ProfessionalExperience>]
|
57
|
+
attr_reader :professional_experiences
|
58
|
+
# The list of social network profiles of the candidate.
|
59
|
+
# @return [Array<Mindee::Product::Resume::ResumeV1SocialNetworksUrl>]
|
60
|
+
attr_reader :social_networks_urls
|
61
|
+
# The list of the candidate's interpersonal and communication abilities.
|
62
|
+
# @return [Array<Mindee::Parsing::Standard::StringField>]
|
63
|
+
attr_reader :soft_skills
|
64
|
+
# The candidate's last names.
|
65
|
+
# @return [Array<Mindee::Parsing::Standard::StringField>]
|
66
|
+
attr_reader :surnames
|
67
|
+
|
68
|
+
# @param prediction [Hash]
|
69
|
+
# @param page_id [Integer, nil]
|
70
|
+
def initialize(prediction, page_id)
|
71
|
+
super()
|
72
|
+
@address = StringField.new(prediction['address'], page_id)
|
73
|
+
@certificates = []
|
74
|
+
prediction['certificates'].each do |item|
|
75
|
+
@certificates.push(ResumeV1Certificate.new(item, page_id))
|
76
|
+
end
|
77
|
+
@document_language = StringField.new(prediction['document_language'], page_id)
|
78
|
+
@document_type = ClassificationField.new(prediction['document_type'], page_id)
|
79
|
+
@education = []
|
80
|
+
prediction['education'].each do |item|
|
81
|
+
@education.push(ResumeV1Education.new(item, page_id))
|
82
|
+
end
|
83
|
+
@email_address = StringField.new(prediction['email_address'], page_id)
|
84
|
+
@given_names = []
|
85
|
+
prediction['given_names'].each do |item|
|
86
|
+
@given_names.push(StringField.new(item, page_id))
|
87
|
+
end
|
88
|
+
@hard_skills = []
|
89
|
+
prediction['hard_skills'].each do |item|
|
90
|
+
@hard_skills.push(StringField.new(item, page_id))
|
91
|
+
end
|
92
|
+
@job_applied = StringField.new(prediction['job_applied'], page_id)
|
93
|
+
@languages = []
|
94
|
+
prediction['languages'].each do |item|
|
95
|
+
@languages.push(ResumeV1Language.new(item, page_id))
|
96
|
+
end
|
97
|
+
@nationality = StringField.new(prediction['nationality'], page_id)
|
98
|
+
@phone_number = StringField.new(prediction['phone_number'], page_id)
|
99
|
+
@profession = StringField.new(prediction['profession'], page_id)
|
100
|
+
@professional_experiences = []
|
101
|
+
prediction['professional_experiences'].each do |item|
|
102
|
+
@professional_experiences.push(ResumeV1ProfessionalExperience.new(item, page_id))
|
103
|
+
end
|
104
|
+
@social_networks_urls = []
|
105
|
+
prediction['social_networks_urls'].each do |item|
|
106
|
+
@social_networks_urls.push(ResumeV1SocialNetworksUrl.new(item, page_id))
|
107
|
+
end
|
108
|
+
@soft_skills = []
|
109
|
+
prediction['soft_skills'].each do |item|
|
110
|
+
@soft_skills.push(StringField.new(item, page_id))
|
111
|
+
end
|
112
|
+
@surnames = []
|
113
|
+
prediction['surnames'].each do |item|
|
114
|
+
@surnames.push(StringField.new(item, page_id))
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
# @return [String]
|
119
|
+
def to_s
|
120
|
+
given_names = @given_names.join("\n #{' ' * 13}")
|
121
|
+
surnames = @surnames.join("\n #{' ' * 10}")
|
122
|
+
social_networks_urls = social_networks_urls_to_s
|
123
|
+
languages = languages_to_s
|
124
|
+
hard_skills = @hard_skills.join("\n #{' ' * 13}")
|
125
|
+
soft_skills = @soft_skills.join("\n #{' ' * 13}")
|
126
|
+
education = education_to_s
|
127
|
+
professional_experiences = professional_experiences_to_s
|
128
|
+
certificates = certificates_to_s
|
129
|
+
out_str = String.new
|
130
|
+
out_str << "\n:Document Language: #{@document_language}".rstrip
|
131
|
+
out_str << "\n:Document Type: #{@document_type}".rstrip
|
132
|
+
out_str << "\n:Given Names: #{given_names}".rstrip
|
133
|
+
out_str << "\n:Surnames: #{surnames}".rstrip
|
134
|
+
out_str << "\n:Nationality: #{@nationality}".rstrip
|
135
|
+
out_str << "\n:Email Address: #{@email_address}".rstrip
|
136
|
+
out_str << "\n:Phone Number: #{@phone_number}".rstrip
|
137
|
+
out_str << "\n:Address: #{@address}".rstrip
|
138
|
+
out_str << "\n:Social Networks:"
|
139
|
+
out_str << social_networks_urls
|
140
|
+
out_str << "\n:Profession: #{@profession}".rstrip
|
141
|
+
out_str << "\n:Job Applied: #{@job_applied}".rstrip
|
142
|
+
out_str << "\n:Languages:"
|
143
|
+
out_str << languages
|
144
|
+
out_str << "\n:Hard Skills: #{hard_skills}".rstrip
|
145
|
+
out_str << "\n:Soft Skills: #{soft_skills}".rstrip
|
146
|
+
out_str << "\n:Education:"
|
147
|
+
out_str << education
|
148
|
+
out_str << "\n:Professional Experiences:"
|
149
|
+
out_str << professional_experiences
|
150
|
+
out_str << "\n:Certificates:"
|
151
|
+
out_str << certificates
|
152
|
+
out_str[1..].to_s
|
153
|
+
end
|
154
|
+
|
155
|
+
private
|
156
|
+
|
157
|
+
# @param char [String]
|
158
|
+
# @return [String]
|
159
|
+
def social_networks_urls_separator(char)
|
160
|
+
out_str = String.new
|
161
|
+
out_str << ' '
|
162
|
+
out_str << "+#{char * 22}"
|
163
|
+
out_str << "+#{char * 52}"
|
164
|
+
out_str << '+'
|
165
|
+
out_str
|
166
|
+
end
|
167
|
+
|
168
|
+
# @return [String]
|
169
|
+
def social_networks_urls_to_s
|
170
|
+
return '' if @social_networks_urls.empty?
|
171
|
+
|
172
|
+
line_items = @social_networks_urls.map(&:to_table_line).join("\n#{social_networks_urls_separator('-')}\n ")
|
173
|
+
out_str = String.new
|
174
|
+
out_str << "\n#{social_networks_urls_separator('-')}"
|
175
|
+
out_str << "\n |"
|
176
|
+
out_str << ' Name |'
|
177
|
+
out_str << ' URL |'
|
178
|
+
out_str << "\n#{social_networks_urls_separator('=')}"
|
179
|
+
out_str << "\n #{line_items}"
|
180
|
+
out_str << "\n#{social_networks_urls_separator('-')}"
|
181
|
+
out_str
|
182
|
+
end
|
183
|
+
|
184
|
+
# @param char [String]
|
185
|
+
# @return [String]
|
186
|
+
def languages_separator(char)
|
187
|
+
out_str = String.new
|
188
|
+
out_str << ' '
|
189
|
+
out_str << "+#{char * 10}"
|
190
|
+
out_str << "+#{char * 22}"
|
191
|
+
out_str << '+'
|
192
|
+
out_str
|
193
|
+
end
|
194
|
+
|
195
|
+
# @return [String]
|
196
|
+
def languages_to_s
|
197
|
+
return '' if @languages.empty?
|
198
|
+
|
199
|
+
line_items = @languages.map(&:to_table_line).join("\n#{languages_separator('-')}\n ")
|
200
|
+
out_str = String.new
|
201
|
+
out_str << "\n#{languages_separator('-')}"
|
202
|
+
out_str << "\n |"
|
203
|
+
out_str << ' Language |'
|
204
|
+
out_str << ' Level |'
|
205
|
+
out_str << "\n#{languages_separator('=')}"
|
206
|
+
out_str << "\n #{line_items}"
|
207
|
+
out_str << "\n#{languages_separator('-')}"
|
208
|
+
out_str
|
209
|
+
end
|
210
|
+
|
211
|
+
# @param char [String]
|
212
|
+
# @return [String]
|
213
|
+
def education_separator(char)
|
214
|
+
out_str = String.new
|
215
|
+
out_str << ' '
|
216
|
+
out_str << "+#{char * 17}"
|
217
|
+
out_str << "+#{char * 27}"
|
218
|
+
out_str << "+#{char * 11}"
|
219
|
+
out_str << "+#{char * 10}"
|
220
|
+
out_str << "+#{char * 27}"
|
221
|
+
out_str << "+#{char * 13}"
|
222
|
+
out_str << "+#{char * 12}"
|
223
|
+
out_str << '+'
|
224
|
+
out_str
|
225
|
+
end
|
226
|
+
|
227
|
+
# @return [String]
|
228
|
+
def education_to_s
|
229
|
+
return '' if @education.empty?
|
230
|
+
|
231
|
+
line_items = @education.map(&:to_table_line).join("\n#{education_separator('-')}\n ")
|
232
|
+
out_str = String.new
|
233
|
+
out_str << "\n#{education_separator('-')}"
|
234
|
+
out_str << "\n |"
|
235
|
+
out_str << ' Domain |'
|
236
|
+
out_str << ' Degree |'
|
237
|
+
out_str << ' End Month |'
|
238
|
+
out_str << ' End Year |'
|
239
|
+
out_str << ' School |'
|
240
|
+
out_str << ' Start Month |'
|
241
|
+
out_str << ' Start Year |'
|
242
|
+
out_str << "\n#{education_separator('=')}"
|
243
|
+
out_str << "\n #{line_items}"
|
244
|
+
out_str << "\n#{education_separator('-')}"
|
245
|
+
out_str
|
246
|
+
end
|
247
|
+
|
248
|
+
# @param char [String]
|
249
|
+
# @return [String]
|
250
|
+
def professional_experiences_separator(char)
|
251
|
+
out_str = String.new
|
252
|
+
out_str << ' '
|
253
|
+
out_str << "+#{char * 17}"
|
254
|
+
out_str << "+#{char * 12}"
|
255
|
+
out_str << "+#{char * 27}"
|
256
|
+
out_str << "+#{char * 11}"
|
257
|
+
out_str << "+#{char * 10}"
|
258
|
+
out_str << "+#{char * 22}"
|
259
|
+
out_str << "+#{char * 13}"
|
260
|
+
out_str << "+#{char * 12}"
|
261
|
+
out_str << '+'
|
262
|
+
out_str
|
263
|
+
end
|
264
|
+
|
265
|
+
# @return [String]
|
266
|
+
def professional_experiences_to_s
|
267
|
+
return '' if @professional_experiences.empty?
|
268
|
+
|
269
|
+
line_items = @professional_experiences.map(&:to_table_line).join(
|
270
|
+
"\n#{professional_experiences_separator('-')}\n "
|
271
|
+
)
|
272
|
+
out_str = String.new
|
273
|
+
out_str << "\n#{professional_experiences_separator('-')}"
|
274
|
+
out_str << "\n |"
|
275
|
+
out_str << ' Contract Type |'
|
276
|
+
out_str << ' Department |'
|
277
|
+
out_str << ' Employer |'
|
278
|
+
out_str << ' End Month |'
|
279
|
+
out_str << ' End Year |'
|
280
|
+
out_str << ' Role |'
|
281
|
+
out_str << ' Start Month |'
|
282
|
+
out_str << ' Start Year |'
|
283
|
+
out_str << "\n#{professional_experiences_separator('=')}"
|
284
|
+
out_str << "\n #{line_items}"
|
285
|
+
out_str << "\n#{professional_experiences_separator('-')}"
|
286
|
+
out_str
|
287
|
+
end
|
288
|
+
|
289
|
+
# @param char [String]
|
290
|
+
# @return [String]
|
291
|
+
def certificates_separator(char)
|
292
|
+
out_str = String.new
|
293
|
+
out_str << ' '
|
294
|
+
out_str << "+#{char * 12}"
|
295
|
+
out_str << "+#{char * 32}"
|
296
|
+
out_str << "+#{char * 27}"
|
297
|
+
out_str << "+#{char * 6}"
|
298
|
+
out_str << '+'
|
299
|
+
out_str
|
300
|
+
end
|
301
|
+
|
302
|
+
# @return [String]
|
303
|
+
def certificates_to_s
|
304
|
+
return '' if @certificates.empty?
|
305
|
+
|
306
|
+
line_items = @certificates.map(&:to_table_line).join("\n#{certificates_separator('-')}\n ")
|
307
|
+
out_str = String.new
|
308
|
+
out_str << "\n#{certificates_separator('-')}"
|
309
|
+
out_str << "\n |"
|
310
|
+
out_str << ' Grade |'
|
311
|
+
out_str << ' Name |'
|
312
|
+
out_str << ' Provider |'
|
313
|
+
out_str << ' Year |'
|
314
|
+
out_str << "\n#{certificates_separator('=')}"
|
315
|
+
out_str << "\n #{line_items}"
|
316
|
+
out_str << "\n#{certificates_separator('-')}"
|
317
|
+
out_str
|
318
|
+
end
|
319
|
+
end
|
320
|
+
end
|
321
|
+
end
|
322
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../../parsing'
|
4
|
+
|
5
|
+
module Mindee
|
6
|
+
module Product
|
7
|
+
module Resume
|
8
|
+
# The list of the candidate's educational background.
|
9
|
+
class ResumeV1Education < Mindee::Parsing::Standard::FeatureField
|
10
|
+
include Mindee::Parsing::Standard
|
11
|
+
# The area of study or specialization.
|
12
|
+
# @return [String]
|
13
|
+
attr_reader :degree_domain
|
14
|
+
# The type of degree obtained, such as Bachelor's, Master's, or Doctorate.
|
15
|
+
# @return [String]
|
16
|
+
attr_reader :degree_type
|
17
|
+
# The month when the education program or course was completed.
|
18
|
+
# @return [String]
|
19
|
+
attr_reader :end_month
|
20
|
+
# The year when the education program or course was completed.
|
21
|
+
# @return [String]
|
22
|
+
attr_reader :end_year
|
23
|
+
# The name of the school.
|
24
|
+
# @return [String]
|
25
|
+
attr_reader :school
|
26
|
+
# The month when the education program or course began.
|
27
|
+
# @return [String]
|
28
|
+
attr_reader :start_month
|
29
|
+
# The year when the education program or course began.
|
30
|
+
# @return [String]
|
31
|
+
attr_reader :start_year
|
32
|
+
|
33
|
+
# @param prediction [Hash]
|
34
|
+
# @param page_id [Integer, nil]
|
35
|
+
def initialize(prediction, page_id)
|
36
|
+
super(prediction, page_id)
|
37
|
+
@degree_domain = prediction['degree_domain']
|
38
|
+
@degree_type = prediction['degree_type']
|
39
|
+
@end_month = prediction['end_month']
|
40
|
+
@end_year = prediction['end_year']
|
41
|
+
@school = prediction['school']
|
42
|
+
@start_month = prediction['start_month']
|
43
|
+
@start_year = prediction['start_year']
|
44
|
+
@page_id = page_id
|
45
|
+
end
|
46
|
+
|
47
|
+
# @return [Hash]
|
48
|
+
def printable_values
|
49
|
+
printable = {}
|
50
|
+
printable[:degree_domain] = format_for_display(@degree_domain, 15)
|
51
|
+
printable[:degree_type] = format_for_display(@degree_type, 25)
|
52
|
+
printable[:end_month] = format_for_display(@end_month, nil)
|
53
|
+
printable[:end_year] = format_for_display(@end_year, nil)
|
54
|
+
printable[:school] = format_for_display(@school, 25)
|
55
|
+
printable[:start_month] = format_for_display(@start_month, nil)
|
56
|
+
printable[:start_year] = format_for_display(@start_year, nil)
|
57
|
+
printable
|
58
|
+
end
|
59
|
+
|
60
|
+
# @return [String]
|
61
|
+
def to_table_line
|
62
|
+
printable = printable_values
|
63
|
+
out_str = String.new
|
64
|
+
out_str << format('| %- 16s', printable[:degree_domain])
|
65
|
+
out_str << format('| %- 26s', printable[:degree_type])
|
66
|
+
out_str << format('| %- 10s', printable[:end_month])
|
67
|
+
out_str << format('| %- 9s', printable[:end_year])
|
68
|
+
out_str << format('| %- 26s', printable[:school])
|
69
|
+
out_str << format('| %- 12s', printable[:start_month])
|
70
|
+
out_str << format('| %- 11s', printable[:start_year])
|
71
|
+
out_str << '|'
|
72
|
+
end
|
73
|
+
|
74
|
+
# @return [String]
|
75
|
+
def to_s
|
76
|
+
printable = printable_values
|
77
|
+
out_str = String.new
|
78
|
+
out_str << "\n :Domain: #{printable[:degree_domain]}"
|
79
|
+
out_str << "\n :Degree: #{printable[:degree_type]}"
|
80
|
+
out_str << "\n :End Month: #{printable[:end_month]}"
|
81
|
+
out_str << "\n :End Year: #{printable[:end_year]}"
|
82
|
+
out_str << "\n :School: #{printable[:school]}"
|
83
|
+
out_str << "\n :Start Month: #{printable[:start_month]}"
|
84
|
+
out_str << "\n :Start Year: #{printable[:start_year]}"
|
85
|
+
out_str
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../../parsing'
|
4
|
+
|
5
|
+
module Mindee
|
6
|
+
module Product
|
7
|
+
module Resume
|
8
|
+
# The list of languages that the candidate is proficient in.
|
9
|
+
class ResumeV1Language < Mindee::Parsing::Standard::FeatureField
|
10
|
+
include Mindee::Parsing::Standard
|
11
|
+
# The language's ISO 639 code.
|
12
|
+
# @return [String]
|
13
|
+
attr_reader :language
|
14
|
+
# The candidate's level for the language.
|
15
|
+
# @return [String]
|
16
|
+
attr_reader :level
|
17
|
+
|
18
|
+
# @param prediction [Hash]
|
19
|
+
# @param page_id [Integer, nil]
|
20
|
+
def initialize(prediction, page_id)
|
21
|
+
super(prediction, page_id)
|
22
|
+
@language = prediction['language']
|
23
|
+
@level = prediction['level']
|
24
|
+
@page_id = page_id
|
25
|
+
end
|
26
|
+
|
27
|
+
# @return [Hash]
|
28
|
+
def printable_values
|
29
|
+
printable = {}
|
30
|
+
printable[:language] = format_for_display(@language, nil)
|
31
|
+
printable[:level] = format_for_display(@level, 20)
|
32
|
+
printable
|
33
|
+
end
|
34
|
+
|
35
|
+
# @return [String]
|
36
|
+
def to_table_line
|
37
|
+
printable = printable_values
|
38
|
+
out_str = String.new
|
39
|
+
out_str << format('| %- 9s', printable[:language])
|
40
|
+
out_str << format('| %- 21s', printable[:level])
|
41
|
+
out_str << '|'
|
42
|
+
end
|
43
|
+
|
44
|
+
# @return [String]
|
45
|
+
def to_s
|
46
|
+
printable = printable_values
|
47
|
+
out_str = String.new
|
48
|
+
out_str << "\n :Language: #{printable[:language]}"
|
49
|
+
out_str << "\n :Level: #{printable[:level]}"
|
50
|
+
out_str
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../../parsing'
|
4
|
+
require_relative 'resume_v1_document'
|
5
|
+
|
6
|
+
module Mindee
|
7
|
+
module Product
|
8
|
+
module Resume
|
9
|
+
# Resume V1 page.
|
10
|
+
class ResumeV1Page < Mindee::Parsing::Common::Page
|
11
|
+
# @param prediction [Hash]
|
12
|
+
def initialize(prediction)
|
13
|
+
super(prediction)
|
14
|
+
@prediction = ResumeV1PagePrediction.new(
|
15
|
+
prediction['prediction'],
|
16
|
+
prediction['id']
|
17
|
+
)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
# Resume V1 page prediction.
|
22
|
+
class ResumeV1PagePrediction < ResumeV1Document
|
23
|
+
# @return [String]
|
24
|
+
def to_s
|
25
|
+
out_str = String.new
|
26
|
+
out_str << "\n#{super}"
|
27
|
+
out_str
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|