Resume OCR Ruby
The Ruby OCR SDK supports the Resume API.
Using the sample below, we are going to illustrate how to extract the data that we want using the OCR SDK.
Quick-Start
require 'mindee'
# Init a new client
mindee_client = Mindee::Client.new(api_key: 'my-api-key')
# Load a file from disk
input_source = mindee_client.source_from_path('/path/to/the/file.ext')
# Parse the file
result = mindee_client.enqueue_and_parse(
input_source,
Mindee::Product::Resume::ResumeV1
)
# Print a full summary of the parsed data in RST format
puts result.document
# Print the document-level parsed data
# puts result.document.inference.prediction
Output (RST):
########
Document
########
:Mindee ID: 9daa3085-152c-454e-9245-636f13fc9dc3
:Filename: default_sample.jpg
Inference
#########
:Product: mindee/resume v1.1
:Rotation applied: Yes
Prediction
==========
:Document Language: ENG
:Document Type: RESUME
:Given Names: Christopher
:Surnames: Morgan
:Nationality:
:Email Address: [email protected]
:Phone Number: +44 (0)20 7666 8555
:Address: 177 Great Portland Street, London, W5W 6PQ
:Social Networks:
+----------------------+----------------------------------------------------+
| Name | URL |
+======================+====================================================+
| LinkedIn | linkedin.com/christopher.morgan |
+----------------------+----------------------------------------------------+
:Profession: Senior Web Developer
:Job Applied:
:Languages:
+----------+----------------------+
| Language | Level |
+==========+======================+
| SPA | Fluent |
+----------+----------------------+
| ZHO | Beginner |
+----------+----------------------+
| DEU | Beginner |
+----------+----------------------+
:Hard Skills: HTML5
PHP OOP
JavaScript
CSS
MySQL
SQL
:Soft Skills: Project management
Creative design
Strong decision maker
Innovative
Complex problem solver
Service-focused
:Education:
+-----------------+---------------------------+-----------+----------+---------------------------+-------------+------------+
| Domain | Degree | End Month | End Year | School | Start Month | Start Year |
+=================+===========================+===========+==========+===========================+=============+============+
| Computer Inf... | Bachelor | | 2014 | Columbia University, NY | | |
+-----------------+---------------------------+-----------+----------+---------------------------+-------------+------------+
:Professional Experiences:
+-----------------+------------+--------------------------------------+---------------------------+-----------+----------+----------------------+-------------+------------+
| Contract Type | Department | Description | Employer | End Month | End Year | Role | Start Month | Start Year |
+=================+============+======================================+===========================+===========+==========+======================+=============+============+
| | | Cooperate with designers to creat... | Luna Web Design, New York | 05 | 2019 | Web Developer | 09 | 2015 |
+-----------------+------------+--------------------------------------+---------------------------+-----------+----------+----------------------+-------------+------------+
:Certificates:
+------------+--------------------------------+---------------------------+------+
| Grade | Name | Provider | Year |
+============+================================+===========================+======+
| | PHP Framework (certificate)... | | |
+------------+--------------------------------+---------------------------+------+
Field Types
Standard Fields
These fields are generic and used in several products.
Basic Field
Each prediction object contains a set of fields that inherit from the generic Field
class.
A typical Field
object will have the following attributes:
- value (
String
,Float
,Integer
,Boolean
): corresponds to the field value. Can benil
if no value was extracted. - confidence (Float, nil): the confidence score of the field prediction.
- bounding_box (
Mindee::Geometry::Quadrilateral
,nil
): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document. - polygon (
Mindee::Geometry::Polygon
,nil
): contains the relative vertices coordinates (Point
) of a polygon containing the field in the image. - page_id (
Integer
,nil
): the ID of the page, alwaysnil
when at document-level. - reconstructed (
Boolean
): indicates whether an object was reconstructed (not extracted as the API gave it).
Aside from the previous attributes, all basic fields have access to a to_s
method that can be used to print their value as a string.
Classification Field
The classification field ClassificationField
does not implement all the basic Field
attributes. It only implements value, confidence and page_id.
Note: a classification field's
value is always a
String`.
String Field
The text field StringField
only has one constraint: it's value is a String
(or nil
).
Specific Fields
Fields which are specific to this product; they are not used in any other product.
Certificates Field
The list of certificates obtained by the candidate.
A ResumeV1Certificate
implements the following attributes:
grade
(String): The grade obtained for the certificate.name
(String): The name of certification.provider
(String): The organization or institution that issued the certificate.year
(String): The year when a certificate was issued or received.
Fields which are specific to this product; they are not used in any other product.
Education Field
The list of the candidate's educational background.
A ResumeV1Education
implements the following attributes:
degree_domain
(String): The area of study or specialization.degree_type
(String): The type of degree obtained, such as Bachelor's, Master's, or Doctorate.end_month
(String): The month when the education program or course was completed.end_year
(String): The year when the education program or course was completed.school
(String): The name of the school.start_month
(String): The month when the education program or course began.start_year
(String): The year when the education program or course began.
Fields which are specific to this product; they are not used in any other product.
Languages Field
The list of languages that the candidate is proficient in.
A ResumeV1Language
implements the following attributes:
language
(String): The language's ISO 639 code.level
(String): The candidate's level for the language.
Possible values include:
- Native
- Fluent
- Proficient
- Intermediate
- Beginner
Fields which are specific to this product; they are not used in any other product.
Professional Experiences Field
The list of the candidate's professional experiences.
A ResumeV1ProfessionalExperience
implements the following attributes:
contract_type
(String): The type of contract for the professional experience.
Possible values include:
- Full-Time
- Part-Time
- Internship
- Freelance
department
(String): The specific department or division within the company.description
(String): The description of the professional experience as written in the document.employer
(String): The name of the company or organization.end_month
(String): The month when the professional experience ended.end_year
(String): The year when the professional experience ended.role
(String): The position or job title held by the candidate.start_month
(String): The month when the professional experience began.start_year
(String): The year when the professional experience began.
Fields which are specific to this product; they are not used in any other product.
Social Networks Field
The list of social network profiles of the candidate.
A ResumeV1SocialNetworksUrl
implements the following attributes:
name
(String): The name of the social network.url
(String): The URL of the social network.
Attributes
The following fields are extracted for Resume V1:
Address
address (StringField): The location information of the candidate, including city, state, and country.
puts result.document.inference.prediction.address.value
Certificates
certificates (Array<ResumeV1Certificate>): The list of certificates obtained by the candidate.
for certificates_elem in result.document.inference.prediction.certificates do
puts certificates_elem.value
end
Document Language
document_language (StringField): The ISO 639 code of the language in which the document is written.
puts result.document.inference.prediction.document_language.value
Document Type
document_type (ClassificationField): The type of the document sent.
Possible values include:
- RESUME
- MOTIVATION_LETTER
- RECOMMENDATION_LETTER
puts result.document.inference.prediction.document_type.value
Education
education (Array<ResumeV1Education>): The list of the candidate's educational background.
for education_elem in result.document.inference.prediction.education do
puts education_elem.value
end
Email Address
email_address (StringField): The email address of the candidate.
puts result.document.inference.prediction.email_address.value
Given Names
given_names (Array<StringField>): The candidate's first or given names.
for given_names_elem in result.document.inference.prediction.given_names do
puts given_names_elem.value
end
Hard Skills
hard_skills (Array<StringField>): The list of the candidate's technical abilities and knowledge.
for hard_skills_elem in result.document.inference.prediction.hard_skills do
puts hard_skills_elem.value
end
Job Applied
job_applied (StringField): The position that the candidate is applying for.
puts result.document.inference.prediction.job_applied.value
Languages
languages (Array<ResumeV1Language>): The list of languages that the candidate is proficient in.
for languages_elem in result.document.inference.prediction.languages do
puts languages_elem.value
end
Nationality
nationality (StringField): The ISO 3166 code for the country of citizenship of the candidate.
puts result.document.inference.prediction.nationality.value
Phone Number
phone_number (StringField): The phone number of the candidate.
puts result.document.inference.prediction.phone_number.value
Profession
profession (StringField): The candidate's current profession.
puts result.document.inference.prediction.profession.value
Professional Experiences
professional_experiences (Array<ResumeV1ProfessionalExperience>): The list of the candidate's professional experiences.
for professional_experiences_elem in result.document.inference.prediction.professional_experiences do
puts professional_experiences_elem.value
end
Social Networks
social_networks_urls (Array<ResumeV1SocialNetworksUrl>): The list of social network profiles of the candidate.
for social_networks_urls_elem in result.document.inference.prediction.social_networks_urls do
puts social_networks_urls_elem.value
end
Soft Skills
soft_skills (Array<StringField>): The list of the candidate's interpersonal and communication abilities.
for soft_skills_elem in result.document.inference.prediction.soft_skills do
puts soft_skills_elem.value
end
Surnames
surnames (Array<StringField>): The candidate's last names.
for surnames_elem in result.document.inference.prediction.surnames do
puts surnames_elem.value
end
Questions?
Updated 7 days ago