def keyWordExtraction(): description = {'Title': 'Software Engineer', 'Skill': ['Microsoft Office', 'Data Mining', 'Image Processing','Android','MySQL'], 'Certification': 'Random value', 'Volunteering': 'Random value'} resumesInput = [] resumes = [] decorators = {'Skill':ex.skills_dec , 'Language':ex.language_dec , 'Experience':ex.experience_dec} extractor = ex.get_base decorator = ex.experience_dec extractor = decorator(extractor) for key in job_description: decorator = decorators.get(key) if decorator!= None: extractor = decorator(extractor) # decorator = decorators["Language"] # extractor = decorator(extractor) # decorator = decorators["Experience"] # extractor = decorator(extractor) resumesInput.append('static/IsenNg.pdf') resumesInput.append('static/DonnabelleEmbodo.pdf') resumesInput.append('static/DesmondLim.pdf') resumesInput.append('static/JinYuanTeo.pdf') for resumeInput in resumesInput: forExtractorInput = convertPDF.convertWithCoordinatesPara(resumeInput) resume = extractor(forExtractorInput['pdfText']) resume = "{" + resume +"}" resumes.append(resume) first = True output = "[" for resume in resumes: if first: output = output + resume first = False else: output = output + "," + resume output = output + "]" forAnalyzer = ast.literal_eval(output) #print forAnalyzer result = analyzer.process_analyzer(description, forAnalyzer) return output
def analyzeCV(): #setup extractor with base and decorators decorators = {'Skill':ex.skills_dec , 'Language':ex.language_dec , 'Experience':ex.experience_dec} extractor = ex.get_base decorator = decorators["Skill"] extractor = decorator(extractor) decorator = decorators["Experience"] extractor = decorator(extractor) decorator = decorators["Language"] extractor = decorator(extractor) #retrieve files from static resumesDir = os.listdir('static') resumeFiles = [] resumes = [] for resumeFile in resumesDir: if resumeFile.endswith(".pdf"): resumeFiles.append('static/'+ resumeFile) for resumeFile in resumeFiles: forExtractorInput = convertPDF.convertWithCoordinatesPara(resumeFile) resume = extractor(forExtractorInput['pdfText']) resume = "{" + resume +"}" resumes.append(resume) first = True analyzerResumesInput = "[" for resume in resumes: if first: analyzerResumesInput = analyzerResumesInput + resume first = False else: analyzerResumesInput = analyzerResumesInput + "," + resume print job_description analyzerResumesInput = analyzerResumesInput + "]" analyzerDictResumesInput = ast.literal_eval(analyzerResumesInput) result = analyzer.process_analyzer(job_description, analyzerDictResumesInput) return json.dumps(result)
def hello(): return json.dumps(convertPDF.convertWithCoordinatesPara('static/YaminiBhaskar.pdf'))