Skip to content

Commit d390d63

Browse files
authored
Merge pull request #12 from lakshmanaram/master
added degree info feature
2 parents cdb93bb + d8c0f47 commit d390d63

File tree

9 files changed

+435
-105
lines changed

9 files changed

+435
-105
lines changed

README.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ cvscan add -s "C,C++,R,Java"
2525
```
2626
cvscan remove --skill "C,C++"
2727
```
28+
2829
## Jobs
2930
### add
3031
Adding
@@ -41,6 +42,7 @@ Removing
4142
```
4243
cvscan remove --job "contributor,Android Programmer"
4344
```
45+
4446
## Organizations
4547
### add
4648
```
@@ -50,3 +52,72 @@ cvscan add --org "Skcript"
5052
```
5153
cvscan remove -o "Skcript"
5254
```
55+
56+
## Qualifications
57+
Note:
58+
* Qualifications are case-sensitive.
59+
* Puntuations before the first and after the last alphabet should be excluded
60+
61+
### add
62+
```
63+
cvscan add -q "B.S,B.Tech,B.Arch"
64+
```
65+
### remove
66+
```
67+
cvscan remove --qual "B.Arch"
68+
```
69+
70+
## Extra Information
71+
### add
72+
```
73+
cvscan add -e "machine learning,artificial intelligence"
74+
```
75+
### remove
76+
```
77+
cvscan remove --extra "machine learning,artificial intelligence"
78+
```
79+
80+
File Descriptions
81+
============
82+
## class Cvscan
83+
```
84+
cvscan = Cvscan(name,path)
85+
```
86+
#### Extract
87+
Convert the input file to raw_text and calls parse class method
88+
```
89+
cvscan.extract()
90+
```
91+
#### Display extracted text
92+
```
93+
cvscan.show()
94+
```
95+
### Attributes
96+
| Attributes | Function |
97+
|---------------------|-----------|
98+
|path | Stores the path of the resume |
99+
|raw_text | Stores the resume as raw text |
100+
|URLs | Stores all the URLs from the resume |
101+
|name | Applicant's name |
102+
|emails | Applicant's email |
103+
|Phone number | Applicant's contact number |
104+
|address | Applicant's address |
105+
|experience | Applicant's experience in years |
106+
|cleaned_resume | Raw text after removing english stopwords |
107+
|skills | Applicant's skillset |
108+
|qualifications | Applicant's qualifications |
109+
|degree_info | Info about qualification |
110+
|job_positions | Applicant's jobs |
111+
|category | Applicant's Job category |
112+
|current_employers | Organization applicant is working in |
113+
|employers | All organizations applicant has worked in |
114+
|extra_info | Extra information about the applicant|
115+
<!--
116+
## configurations.py
117+
Contains the regular expressions used throughout the project
118+
## converter.py
119+
Contains methods to convert resume from input format to raw text
120+
#### pdf_to_text
121+
Uses pdfminer library to fetch raw text from the resume. Special characters and bullets in the resume are replaced with a newline character.
122+
This formatted text from the resume is returned.
123+
-->

cvscan/__init__.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def extract(self):
3535
if self.raw_text is not '':
3636
self.parse()
3737
else:
38-
raise ValueError("Error parsing resume.")
38+
raise ValueError("Error extracting resume text.")
3939

4040
def parse(self):
4141
self.URLs = annotations_parser.fetch_pdf_urls(self.path)
@@ -45,10 +45,13 @@ def parse(self):
4545
self.address = dp.fetch_address(self.raw_text)
4646
self.experience = dp.calculate_experience(self.raw_text)
4747
self.cleaned_resume = lp.clean_resume(self.raw_text)
48-
self.skills = lp.fetch_skills(self.cleaned_resume)
48+
self.skills = dp.fetch_skills(self.cleaned_resume)
49+
(self.qualifications,self.degree_info) = dp.fetch_qualifications(
50+
self.raw_text)
4951
self.job_positions, self.category = dp.fetch_jobs(self.cleaned_resume)
5052
self.current_employers,self.employers = lp.fetch_employers(
5153
self.raw_text,self.job_positions)
54+
self.extra_info = dp.fetch_extra(self.raw_text)
5255

5356
# TODO: Add more fetch here
5457
def show(self):
@@ -63,5 +66,8 @@ def show(self):
6366
"jobs" : self.job_positions,
6467
"job category" : self.category,
6568
"employers" : self.employers,
66-
"current_employers" : self.current_employers
67-
}
69+
"current_employers" : self.current_employers,
70+
"qualifications" : self.qualifications,
71+
"qualifications_info" : self.degree_info,
72+
"extra_info" : self.extra_info
73+
}

cvscan/cli/cli.py

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,29 @@ def parse(name):
4242
@click.option('--org','-o',help='Explicitly add organizations')
4343
@click.option('--skill','-s',help='Add skills')
4444
@click.option('--job','-j',help='For adding jobs: -j <job:category>')
45-
def add(org,skill,job):
45+
@click.option('--qual','-q',help="Add qualifications")
46+
@click.option('--extra','-e',help = "Add Extra information")
47+
def add(org,skill,job,qual,extra):
4648
"""
4749
4850
Add data to be considered\n
4951
Params: \n
5052
org Type: comma separated string\n
5153
skill Type: comma separated string\n
5254
job Type: comma separated string (comma separated - job:category)\n
55+
qual Type: comma separated string\n
5356
Usage:\n
5457
For adding organization:\n
5558
cvscan add --org <org_name,org_name,...>\n
5659
For adding skill:\n
5760
cvscan add --skill <skill,skill,...>\n
5861
For adding job:\n
5962
cvscan add --job <job:category,job:category,...>\n
63+
For adding qualification:\n
64+
cvscan add --qual <degree,degree,..>\n
65+
punctuations before the first and after the last alphabet are excluded\n
66+
For adding extra information:\n
67+
cvscan add --extra <extra,extra>\n
6068
The above can be combined together also. Eg:\n
6169
cvscan add -o <org_name,org_name,..> -s <skill,skill,..> is also valid
6270
@@ -74,29 +82,40 @@ def add(org,skill,job):
7482
except Exception:
7583
print "Something wnet wrong: " + Exception
7684
do.add_jobs(jobs)
77-
85+
if qual:
86+
do.add_qualifications(qual.split(','))
87+
if extra:
88+
do.add_extra(extra.split(','))
7889

7990
@main.command()
8091
@click.option('--org','-o',help='Explicitly remove organizations')
8192
@click.option('--skill','-s',help='Remove skills')
8293
@click.option('--job','-j',help='For removing jobs -j <job>')
83-
def remove(org,skill,job):
94+
@click.option('--qual','-q',help="Remove qualifications")
95+
@click.option('--extra','-e',help = "Remove Extra information")
96+
def remove(org,skill,job,qual,extra):
8497
"""
8598
8699
Remove data from consideration\n
87100
Params:\n
88101
org Type: comma separated string\n
89102
skill Type: comma separated string\n
90103
job Type: comma separated string\n
104+
qual Type: comma separated string\n
91105
Usage:\n
92-
For adding organization:\n
106+
For removing organization:\n
93107
cvscan remove --org <org_name,org_name,..>\n
94-
For adding skill:\n
108+
For removing skill:\n
95109
cvscan remove --skill <skill,skill,..>\n
96-
For adding job:\n
110+
For removing job:\n
97111
cvscan remove --job <job,job,..>\n
112+
For removing qualification:\n
113+
cvscan remove -q <degree,degree,..>\n
114+
punctuations before the first and after the last alphabet are excluded\n
115+
For removing extra information:\n
116+
cvscan remove -e <extra,extra>\n
98117
The above can be combined together also. Eg:\n
99-
cvscan remove -o <org_name,org_name,..> -s <skill,skill,..> -j <job>
118+
cvscan remove -o <org_name,org_name,..> -s <skill,skill,..> -j <job>
100119
is also valid
101120
102121
"""
@@ -105,4 +124,8 @@ def remove(org,skill,job):
105124
if skill:
106125
do.remove_skills(skill.split(','))
107126
if job:
108-
do.remove_jobs(job.split(','))
127+
do.remove_jobs(job.split(','))
128+
if qual:
129+
do.remove_qualifications(qual.split(','))
130+
if extra:
131+
do.remove_extra(extra.split(','))

cvscan/data/extra/extra

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
(lp0
2+
.

cvscan/data/qualifications/degree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
(lp0
2+
S'B.Tech'
3+
p1
4+
aS'B.E'
5+
p2
6+
aS'B.Arch'
7+
p3
8+
aS'B. Tech'
9+
p4
10+
aS'M.Tech'
11+
p5
12+
aS'M. Tech'
13+
p6
14+
a.

cvscan/data_operations.py

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,3 +169,95 @@ def remove_jobs(jobs_to_remove):
169169
with open(DATAPATH +'job_positions/positions','wb') as fp:
170170
pickle.dump(jobs,fp)
171171
logging.debug("updated positions file")
172+
173+
174+
"""
175+
176+
An Utility function to add qualification to the degree file.
177+
Params: qualifications Type: List of String
178+
Qualifications are case-sensitive.
179+
Care should be taken with the punctuations.
180+
Exclude punctuations before the first alphabet and after the last alphabet.
181+
182+
"""
183+
def add_qualifications(quals):
184+
with open(DATAPATH + 'qualifications/degree','rb') as fp:
185+
qualifications = pickle.load(fp)
186+
logging.debug("degree file loaded")
187+
188+
for qual in quals:
189+
if qual not in qualifications:
190+
qualifications.append(qual)
191+
logging.debug(qual + " added to qualifications")
192+
193+
with open(DATAPATH + 'qualifications/degree','wb') as fp:
194+
pickle.dump(qualifications, fp)
195+
logging.debug("degree file written")
196+
197+
198+
"""
199+
200+
An Utility function to remove qualification from the degree file.
201+
Params: qualifications Type: List of String
202+
Qualifications are case-sensitive.
203+
Care should be taken with the punctuations.
204+
Exclude punctuations before the first alphabet and after the last alphabet.
205+
206+
"""
207+
def remove_qualifications(quals):
208+
with open(DATAPATH + 'qualifications/degree','rb') as fp:
209+
qualifications = pickle.load(fp)
210+
logging.debug("degree file loaded")
211+
212+
for qual in quals:
213+
if qual in qualifications:
214+
qualifications.remove(qual)
215+
logging.debug(qual + " removed from qualifications")
216+
217+
with open(DATAPATH + 'qualifications/degree','wb') as fp:
218+
pickle.dump(qualifications, fp)
219+
logging.debug("degree file written")
220+
221+
222+
"""
223+
224+
An Utility function to add extra information to the extra file.
225+
Params: extra_info Type: List of String
226+
extra_info are case-sensitive.
227+
228+
"""
229+
def add_extra(extra_info):
230+
with open(DATAPATH + 'extra/extra','rb') as fp:
231+
extra = pickle.load(fp)
232+
logging.debug("extra file loaded")
233+
234+
for e in extra_info:
235+
if e not in extra:
236+
extra.append(e)
237+
logging.debug(e + " added to extra information")
238+
239+
with open(DATAPATH + 'extra/extra','wb') as fp:
240+
pickle.dump(extra, fp)
241+
logging.debug("extra file written")
242+
243+
244+
"""
245+
246+
An Utility function to remove extra information from the extra file.
247+
Params: extra_info Type: List of String
248+
Extra informations are case-sensitive.
249+
250+
"""
251+
def remove_extra(extra_info):
252+
with open(DATAPATH + 'extra/extra','rb') as fp:
253+
extra = pickle.load(fp)
254+
logging.debug("extra file loaded")
255+
256+
for e in extra_info:
257+
if e in extra:
258+
extra.remove(e)
259+
logging.debug(e + " removed from extra information")
260+
261+
with open(DATAPATH + 'extra/extra','wb') as fp:
262+
pickle.dump(extra, fp)
263+
logging.debug("extra file written")

0 commit comments

Comments
 (0)