-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathResumeOriginal.java
More file actions
304 lines (268 loc) · 12.5 KB
/
ResumeOriginal.java
File metadata and controls
304 lines (268 loc) · 12.5 KB
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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
//Duaa Zaheer, Davin Kyi, Allison Li
//11/20/2020
//Resume Reader
//Method description
/*
This is a program that will be able to give you a short anaylsis of a resume in
which you will be looking at. This will give a company a quick anaylsis on which
resume in which they looked at is most highly ranked, in other words, which one has
more points when compared to the other resumes given. Also, the program can also
give you the amount of experience you've had with a certain keyword, such as java.
This program will also allow you to see if the basic skills, such as Java are given
in the resume, and this is done by checking to see if it is contained within the
resume given. Last and not least, it will give you all the words that are contained
within the resume you are looking at.
*/
import java.util.*;
import java.io.*;
public class ResumeOriginal implements Comparable<Resume> {
//imagine if a person say present
private static final String present = "present";
//name of the person who wrote the resume
private String name;
//this most likely will just tell you all the words it contains
private Set<String> keyWords;
//this will most likely come from the getExperience() method
//but we need to somehow have a compare method for this
//and this will likely require an algorithm
private Map<String, Integer> experience; //<Keyword, Experience>
//this will most likely be the amount of points calculated from the
//algorithms class in which will be made by allison
private int totalPoints;
//these are the months in the years, and they are abbreviated
private ArrayList<String> months;
//this is for the format method in which we might for the resume class, if needed
private String[] formats = {"%m/%d/%y", "%M %d, %y", "%d/%m/%y"};
//these are helper fields for the methods, to help store the data
private Map<String, Integer> time;
private Scanner scanner;
//percentile of the canidate relative to other canidates
private double percentile;
//this is the file of the resume
private File resumeData;
//i think we are going to pass in a file instead perhaps
public Resume(File file) throws FileNotFoundException {
this.name = "";
this.resumeData = file;
scanner = new Scanner(file);
//initalizing the Set of keywords in which we will be returning later
this.keyWords = new HashSet<String>();
while(scanner.hasNext()) {
String word = scanner.next();
this.keyWords.add(word);
}
this.experience = new HashMap<String, Integer>();
//the questions is when will we add in the points, maybe we want to have them after the algorithm gets the value
//want this to set this to a value of 0 for now, and later find some way
//YOU WILL WANT TO FIND A WAY HOW TO MAKE AN ALGORITHM OBJECT, AND ASK IT FOR THE TOTAL AMOUNT OF POINTS LATER
this.totalPoints = 0;
//this.totalPoints = totalPoints;
this.time = new HashMap<String, Integer>();
//first one is 11/30/2015, Nov 27, 2002
String [] months = {"jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"};
for (int i = 0; i < months.length; i++) {
this.months.add(months[i]);
}
}
//maybe we will assume that the person's name is the first two words in the resume
//this will return the name of the person wo wrote the resume
public String getName() {
//we have to determine how to get the name from the resume
//THIS WILL BE THE FIRST LINE OF THE METHOD, OR THE EMPLOYER WILL PUT IN THE NAME IN HERE
return this.name;
}
public Set<String> getKeyWords() {
return keyWords;
}
/*
//returns the total amount of experience
//which is a map of keywords with the associated amount of time
//for each
public Map<String, Integer> getExperience() {
return this.experience;
}
*/
//returns the total amount of points
public int getTotalPoints() {
return this.totalPoints;
}
//We will need a set and a get method for the percnetile here
public double getPercentile() {
return this.percentile;
}
//this will allow you to compare the points
//you will have to set up some way to say if
//a negative number means something, 0 means equal
//and a postive numbers means something
public int compareTo(Resume other) {
return Integer.compare(this.totalPoints, other.totalPoints);
}
//this will check to see if all of the words are contained within your keyWords needed map
public boolean qualify(Set<String> neededWords) {
return keyWords.containsAll(neededWords);
}
//this will allow you to get all of the individual keywords amount of experience
//by giving you the total time in which has shown up with the word
//THIS IS THE MAIN THING WE NEED TO GET TO WORK, SO FAR THE BASE STRUCTURE GIVEN SO FAR
//SHOULD WORK, WE MIGHT NEED TO DEBUG IF THIS DOSEN'T WORK,
public Map<String, Integer> getExperience() throws FileNotFoundException {
scanner = new Scanner(this.resumeData);
//this will work if we are assuming that the first 2 words are going to be the
//name of the person in which we are talking about
this.name = "";
String firstName = scanner.next();
String lastName = scanner.next();
this.name = firstName + " " + lastName;
while(scanner.hasNextLine()) {
int totalMonths = 0;
String line = scanner.nextLine();
Scanner newScan = new Scanner(line);
//we will probably only want to put the keyword once into the map
//and then from that one line, give that one keyword a time
//this will allow me to only change the times on the keywords found on
//the one line
Set<String> foundWords = new HashSet<String>();
while (newScan.hasNext()) {
//this is a starter for the reading in of the time, but
//this is going to be trickier than i thought
String word = newScan.next();
foundWords.add(word);
if (months.contains(word.substring(0, 3))) {
String startMonth = newScan.next();
int startYear = newScan.nextInt();
//we will think about what to do with a to or a - (always a -, or can it be a to/from, and etc.)
newScan.next(); //throws away the dash in the text
String endMonth = newScan.next().substring(0, 3);
int endYear = newScan.nextInt();
totalMonths += (endYear - startYear) * 12;
//approx 30 days for each month, we can figure this out later as well
totalMonths += months.indexOf(endMonth) - months.indexOf(startMonth);
}
}
for (String keyWord : foundWords) {
//for each of the words that were in that one line
//we will add the additional time
//but, we do not want to add the time to every word found,
//unless if it was on the line
experience.put(keyWord, time.get(keyWord) + totalMonths);
}
}
return experience;
}
// we want to figure out, are we going to be returning how many sets...
public Map<String, Set<String>> containsWanted(Map<String, Set<String>> keyWord) {
Map<String, Set<String>> foundKeyWords = new HashMap<String, Set<String>>();
for (String type : keyWord.keySet()) {
Set<String> possibleKeyWords = keyWord.get(type);
for (String possibleKeyWord : possibleKeyWords) {
if (keyWords.contains(possibleKeyWord)) {
if (!foundKeyWords.containsKey(type)) {
foundKeyWords.put(type, new HashSet<String>());
}
foundKeyWords.get(type).add(possibleKeyWord);
}
}
}
return foundKeyWords;
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//I AM TRYING TO MAKE A METHOD THAT YOU CAN USE FOR MULTIPLE TIME FORMATS
//this is if you have different formats
//this will allow you to get all of the individual keywords amount of experience
//by giving you the total time in which has shown up with the word
/*
public Map<String, Integer> interpretTimeUniversal(File file) throws FileNotFoundException {
scanner = new Scanner(file);
while(scanner.hasNextLine()) {
int totalMonths = 0;
String line = scanner.nextLine();
//we will probably only want to put the keyword once into the map
//and then from that one line, give that one keyword a time
//this will allow me to only change the times on the keywords found on
//the one line
Set<String> foundWords = new HashSet<String>();
for (int i = 0; i < formats.length; i++) {
Scanner newScan = new Scanner(line);
String format = formats[i];
while (newScan.hasNext()) {
//this is a starter for the reading in of the time, but
//this is going to be trickier than i thought
String word = newScan.next();
//Month - jan - dec
//days 1 - 31 <--- we are going to throw this in out algorithm (we might want to capture
//some information on this)
//years just some random years
//if integer / 1000 < 10 && > 0, that is going to be a year, but if interger / 1000 < 0, it is a day
if (months.contains(word.substring(0, 3))) {
String startMonth = newScan.next();
int startYear = newScan.nextInt();
//we will think about what to do with a to or a -
newScan.next(); //throws away the dash in the text
String endMonth = newScan.next().substring(0, 3);
int endYear = newScan.nextInt();
totalMonths += (endYear - startYear) * 12;
//approx 30 days for each month, we can figure this out later as well
totalMonths += months.indexOf(endMonth) - months.indexOf(startMonth);
}
}
}
for (String keyWord : foundWords) {
//for each of the words that were in that one line
//we will add the additional time
//but, we do not want to add the time to every word found,
//unless if it was on the line
experience.put(keyWord, time.get(keyWord) + totalMonths);
}
}
return experience;
}
*/
/////////PossibleMETHODS///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//don't have a file passed in, do something else
//TRY TO MAKE A METHOD WHERE YOU DON'T PASS IN A FILE
/*
//this will allow you to get all the keywords in the document
public Set<String> getkeyWords(File file) throws FileNotFoundException {
scanner = new Scanner(file);
while(scanner.hasNext()) {
String word = scanner.next();
keywords.add(word);
}
return keywords;
}
*/
/*
//this method allows you to see if all the required keywords
//are contained within the resume in which you are looking at
public boolean containsAll(Set<String> contains) {
for (String word : contains) {
if (!keyWords.contains(word)) {
System.out.println("not qualified!");
return false;
}
}
System.out.println("is qualified!");
return true;
}
*/
/*
//this is the qualify method, and this will let us know if a person is a worthy canidate in the
//beginning or not
public boolean qualify(Set<String> neededWords) {
int totalPossibleWords = 0;
int foundWords = 0;
for (String word : neededWords) {
totalPossibleWords++;
if (keyWords.contains(word)) {
foundWords++;
}
}
double percentFound = foundWords * 1.00 / totalPossibleWords;
if (percentFound < 50.0) {
return false;
} else {
return true;
}
}
*/