def match_jobsr(self, resumeModel, jobColl): jobscore = {} for jobModelDict in jobColl.find(): jid = str(jobModelDict["_id"]) # print "jid=", jid jobModel = JobModel(jid) jobModel.deserialize(jobModelDict) score = random.randint(1, 90) # print jid , "--->" ,score jobscore[jid] = score jobscore = sorted(jobscore.items(), key=operator.itemgetter(1), reverse= True) return jobscore
def match_jobsr(self, resumeModel, jobColl): jobscore = {} for jobModelDict in jobColl.find(): jid = str(jobModelDict["_id"]) # print "jid=", jid jobModel = JobModel(jid) jobModel.deserialize(jobModelDict) score = random.randint(1, 90) # print jid , "--->" ,score jobscore[jid] = score jobscore = sorted(jobscore.items(), key=operator.itemgetter(1), reverse=True) return jobscore
def match_jobModels(self, resumeModel, jobModels): jobscore = {} for jobModelDict in jobModels: jid = str(jobModelDict["_id"]) # print "jid=", jid jobModel = JobModel(jid) jobModel.deserialize(jobModelDict) score = int (self.getSimilarity( resumeModel, jobModel )*100) # print jid , "--->" ,score if score > 0 : jobscore[jid] = score jobscore = sorted(jobscore.items(), key=operator.itemgetter(1), reverse= True) return jobscore
def match_jobModels(self, resumeModel, jobModels): jobscore = {} for jobModelDict in jobModels: jid = str(jobModelDict["_id"]) # print "jid=", jid jobModel = JobModel(jid) jobModel.deserialize(jobModelDict) score = int(self.getSimilarity(resumeModel, jobModel) * 100) # print jid , "--->" ,score if score > 0: jobscore[jid] = score jobscore = sorted(jobscore.items(), key=operator.itemgetter(1), reverse=True) return jobscore
def processjobs(dbname, collname): srcBbClient = DbClient('localhost', 27017, dbname) jobCollName = collname jobmodelCollName = jobCollName+"_model" collection = srcBbClient.getCollection(jobCollName) modelColl = srcBbClient.getCollection(jobmodelCollName) # newCol = srcBbClient.getCollection("daily_job_info_2014-06-16") removeHtml(collection) copyTitle(collection) for job in collection.find(): sents = preprocess(job) jobModel = JobModel(job["_id"]) processSents(jobModel, sents ) titleModel = processTitle(job) jobModel.titleModel = titleModel jobclassifier.classifyJob(jobModel) modelColl.save(jobModel.serialize())
import os, sys sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..")) sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..")) sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..", "..")) import modelsimilarity from jobaly.db.dbclient import DbClient from model.jobmodel import JobModel from model.resumemodel import ResumeModel from modelsimilarity import ModelSimilarity resumeModel1 = ResumeModel("r001") resumeModel1.addDegrees(["BS_LEVEL"]) resumeModel1.addMajors(["MAJOR_INFO"]) resumeModel1.addSkills([ "CSS", "J2EE"]) jobModel1 = JobModel("j001") jobModel1.addDegrees(["BS_LEVEL", "MS_LEVEL" ]) jobModel1.addMajors(["MAJOR_CE", "MAJOR_RELATED"]) jobModel1.addSkills([ "HTML", "Java"]) def test_tranferDegree(): degrees = set(["AS_LEVEL", "BS_LEVEL", "MS_LEVEL", "GRAD_LEVEL"]) degreeNum = modelsimilarity.tranferDegree(degrees) for num in degreeNum: print num def test_similarity(): similarity = ModelSimilarity() result = similarity.getSimilarity(resumeModel1 , jobModel1 ) print "result=", result
def markByTitle(self, resumeModel, jobColl): titleModel = resumeModel.titleModels[0] jobmodels = [] pro_lang = None domain = None level = None role = None if titleModel.has_key("pro_lang"): pro_lang = titleModel["pro_lang"] if titleModel.has_key("domain"): domain = titleModel["domain"] if titleModel.has_key("level"): level = titleModel["level"] if titleModel.has_key("role"): role = titleModel["role"] for jobModelDict in jobColl.find(): jid = str(jobModelDict["_id"]) # print "jid=", jid jobModel = JobModel(jid) jobModel.deserialize(jobModelDict) jobSummary = jobModel.summary jobmodels.append(jobModel) if pro_lang is not None and \ jobSummary.has_key("pro_lang") and \ jobSummary["pro_lang"] == pro_lang : jobModel.same_pro_lang = True else: jobModel.same_pro_lang = False if level is not None and \ jobSummary.has_key("level") and \ jobSummary["level"] == pro_lang : jobModel.same_level = True else: jobModel.same_level = False if domain is not None and \ jobSummary.has_key("domain") and \ jobSummary["domain"] == domain : jobModel.same_domain = True else: jobModel.same_domain = False if role is not None and \ jobSummary.has_key("role") and \ jobSummary["role"] == role : jobModel.same_role = True else: jobModel.same_role = False return jobmodels
def markByTitle(self, resumeModel, jobColl): titleModel = resumeModel.titleModels[0] jobmodels = [] pro_lang = None domain = None level = None role = None if titleModel.has_key("pro_lang") : pro_lang = titleModel["pro_lang"] if titleModel.has_key("domain") : domain = titleModel["domain"] if titleModel.has_key("level") : level = titleModel["level"] if titleModel.has_key("role") : role = titleModel["role"] for jobModelDict in jobColl.find(): jid = str(jobModelDict["_id"]) # print "jid=", jid jobModel = JobModel(jid) jobModel.deserialize(jobModelDict) jobSummary = jobModel.summary jobmodels.append(jobModel) if pro_lang is not None and \ jobSummary.has_key("pro_lang") and \ jobSummary["pro_lang"] == pro_lang : jobModel.same_pro_lang = True else : jobModel.same_pro_lang = False if level is not None and \ jobSummary.has_key("level") and \ jobSummary["level"] == pro_lang : jobModel.same_level = True else : jobModel.same_level = False if domain is not None and \ jobSummary.has_key("domain") and \ jobSummary["domain"] == domain : jobModel.same_domain = True else : jobModel.same_domain = False if role is not None and \ jobSummary.has_key("role") and \ jobSummary["role"] == role : jobModel.same_role = True else : jobModel.same_role = False return jobmodels