-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathParsedResume.cs
210 lines (174 loc) · 7.71 KB
/
ParsedResume.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
// Copyright © 2023 Textkernel BV. All rights reserved.
// This file is provided for use by, or on behalf of, Textkernel licensees
// within the terms of their license of Textkernel products or Textkernel customers
// within the Terms of Service pertaining to the Textkernel SaaS products.
using Textkernel.Tx.Models.API.Parsing;
using Textkernel.Tx.Models.Resume.ContactInfo;
using Textkernel.Tx.Models.Resume.Education;
using Textkernel.Tx.Models.Resume.Employment;
using Textkernel.Tx.Models.Resume.Metadata;
using Textkernel.Tx.Models.Resume.Military;
using Textkernel.Tx.Models.Resume.Skills;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Text.Json;
namespace Textkernel.Tx.Models.Resume
{
/// <summary>
/// All of the information extracted while parsing a resume
/// </summary>
public class ParsedResume : ParsedDocument
{
/// <summary>
/// The candidate's contact information found on the resume
/// </summary>
public ContactInformation ContactInformation { get; set; }
/// <summary>
/// The professional summary from the resume
/// </summary>
public string ProfessionalSummary { get; set; }
/// <summary>
/// The candidate's written objective
/// </summary>
public string Objective { get; set; }
/// <summary>
/// The cover letter, if present.
/// </summary>
public string CoverLetter { get; set; }
/// <summary>
/// Personal information provided by the candidate on the resume
/// </summary>
public PersonalAttributes PersonalAttributes { get; set; }
/// <summary>
/// The candidate's education history found on the resume
/// </summary>
public EducationHistory Education { get; set; }
/// <summary>
/// The candidate's employment/work history found on the resume
/// </summary>
public EmploymentHistory EmploymentHistory { get; set; }
/// <summary>
/// All the skills found in the resume when <see cref="SkillsSettings.TaxonomyVersion"/> is set to (or defaults to) "V1".
/// </summary>
[Obsolete("You should use the V2 skills taxonomy instead.")]
public List<ResumeTaxonomyRoot> SkillsData { get; set; }
/// <summary>
/// Skills output when <see cref="SkillsSettings.TaxonomyVersion"/> is set to (or defaults to) "V2".
/// </summary>
public ResumeV2Skills Skills { get; set; }
/// <summary>
/// Certifications found on a resume.
/// </summary>
public List<Certification> Certifications { get; set; }
/// <summary>
/// Licenses found on a resume. These are professional licenses, not driving licenses.
/// For driving licenses, see <see cref="PersonalAttributes.DrivingLicense"/>
/// </summary>
public List<LicenseDetails> Licenses { get; set; }
/// <summary>
/// Associations/organizations found on a resume
/// </summary>
public List<Association> Associations { get; set; }
/// <summary>
/// Any language competencies (fluent in, can read, can write, etc)
/// found in the resume.
/// </summary>
public List<LanguageCompetency> LanguageCompetencies { get; set; }
/// <summary>
/// Any military experience listed on the resume
/// </summary>
public List<MilitaryDetails> MilitaryExperience { get; set; }
/// <summary>
/// Any security credentials/clearances listed on the resume
/// </summary>
public List<SecurityCredential> SecurityCredentials { get; set; }
/// <summary>
/// References listed on a resume.
/// </summary>
public List<CandidateReference> References { get; set; }
/// <summary>
/// Any achievements listed on the resume
/// </summary>
public List<string> Achievements { get; set; }
/// <summary>
/// Any training listed on the resume
/// </summary>
public TrainingHistory Training { get; set; }
/// <summary>
/// A standalone 'skills' section, if listed on the resume
/// </summary>
public string QualificationsSummary { get; set; }
/// <summary>
/// Any hobbies listed on the resume
/// </summary>
public string Hobbies { get; set; }
/// <summary>
/// Any patents listed on the resume
/// </summary>
public string Patents { get; set; }
/// <summary>
/// Any publications listed on the resume
/// </summary>
public string Publications { get; set; }
/// <summary>
/// Any speaking engagements/appearances listed on the resume
/// </summary>
public string SpeakingEngagements { get; set; }
/// <summary>
/// Metadata about the parsed resume
/// </summary>
public ResumeMetadata ResumeMetadata { get; set; }
/// <summary>
/// A list of <see href="https://developer.textkernel.com/tx-platform/v10/ai-matching/overview/user-defined-tags/">user-defined tags</see>
/// that are assigned to this resume. These are used to filter search/match queries in the AI Matching Engine.
/// <br/>
/// <b>NOTE: you may add/remove these prior to indexing. This is the only property you may modify prior to indexing.</b>
/// </summary>
public List<string> UserDefinedTags { get; set; }
/// <summary>
/// You should never create one of these. Instead, these are output by the Resume Parser.
/// The API does not support manually-created resumes to be used in the AI Matching engine.
/// <br/>
/// <strong>
/// To create a resume from a json string, use <see cref="FromJson(string)"/> or <see cref="FromFile(string)"/>
/// </strong>
/// </summary>
[Obsolete("You should never create one of these. Instead, these are output by the Resume Parser")]
public ParsedResume() { }
/// <summary>
/// Create a parsed resume from json. This is useful when you have stored parse results to disk for use later.
/// </summary>
/// <param name="utf8json">The UTF-8 encoded json string</param>
public static ParsedResume FromJson(string utf8json)
{
ParsedResume newResume = JsonSerializer.Deserialize<ParsedResume>(utf8json, TxJsonSerialization.DefaultOptions);
if (newResume.ResumeMetadata == null)
{
//this should never happen, it was bad json
throw new JsonException("The provided JSON is not a valid ParsedResume created by the Resume Parser");
}
return newResume;
}
/// <summary>
/// Load a parsed resume from a json file using UTF-8 encoding. This is useful when you have stored parse results to disk for use later.
/// </summary>
/// <param name="path">The full path to the json file</param>
public static ParsedResume FromFile(string path)
{
return FromJson(File.ReadAllText(path, Encoding.UTF8));
}
/// <summary>
/// Outputs a JSON string that can be saved to disk or any other data storage.
/// <br/>NOTE: be sure to save with UTF-8 encoding!
/// </summary>
/// <param name="formatted"><see langword="true"/> for pretty-printing</param>
public override string ToJson(bool formatted)
{
JsonSerializerOptions options = TxJsonSerialization.DefaultOptions;
options.WriteIndented = formatted;
return JsonSerializer.Serialize(this, options);
}
}
}