예제 #1
0
def prediction_result(top, aplcnt_name, cv_path, personality_values):
    "after applying a job"
    top.withdraw()
    applicant_data = {
        "Candidate Name": aplcnt_name.get(),
        "CV Location": cv_path
    }

    age = personality_values[1]

    print("\n############# Candidate Entered Data #############\n")
    print(applicant_data, personality_values)

    personality = model.test(personality_values)
    print("\n############# Predicted Personality #############\n")
    print(personality)
    data = ResumeParser(cv_path).get_extracted_data()

    try:
        del data['name']
        if len(data['mobile_number']) < 10:
            del data['mobile_number']
    except:
        pass

    print("\n############# Resume Parsed Data #############\n")

    for key in data.keys():
        if data[key] is not None:
            print('{} : {}'.format(key, data[key]))

    result = Tk()
    #  result.geometry('700x550')
    result.overrideredirect(False)
    result.geometry("{0}x{1}+0+0".format(result.winfo_screenwidth(),
                                         result.winfo_screenheight()))
    result.configure(background='White')
    result.title("Predicted Personality")

    #Title
    titleFont = font.Font(family='Arial', size=40, weight='bold')
    Label(result,
          text="Result - Personality Prediction",
          foreground='green',
          bg='white',
          font=titleFont,
          pady=10,
          anchor=CENTER).pack(fill=BOTH)

    Label(result,
          text=str('{} : {}'.format("Name:", aplcnt_name.get())).title(),
          foreground='black',
          bg='white',
          anchor='w').pack(fill=BOTH)
    Label(result,
          text=str('{} : {}'.format("Age:", age)),
          foreground='black',
          bg='white',
          anchor='w').pack(fill=BOTH)
    for key in data.keys():
        if data[key] is not None:
            Label(result,
                  text=str('{} : {}'.format(check_type(key.title()),
                                            check_type(data[key]))),
                  foreground='black',
                  bg='white',
                  anchor='w',
                  width=60).pack(fill=BOTH)
    Label(result,
          text=str("perdicted personality: " + personality).title(),
          foreground='black',
          bg='white',
          anchor='w').pack(fill=BOTH)

    quitBtn = Button(result, text="Exit",
                     command=lambda: result.destroy()).pack()

    terms_mean = """
# Openness:
    People who like to learn new things and enjoy new experiences usually score high in openness. Openness includes traits like being insightful and imaginative and having a wide variety of interests.

# Conscientiousness:
    People that have a high degree of conscientiousness are reliable and prompt. Traits include being organised, methodic, and thorough.

# Extraversion:
    Extraversion traits include being; energetic, talkative, and assertive (sometime seen as outspoken by Introverts). Extraverts get their energy and drive from others, while introverts are self-driven get their drive from within themselves.

# Agreeableness:
    As it perhaps sounds, these individuals are warm, friendly, compassionate and cooperative and traits include being kind, affectionate, and sympathetic. In contrast, people with lower levels of agreeableness may be more distant.

# Neuroticism:
    Neuroticism or Emotional Stability relates to degree of negative emotions. People that score high on neuroticism often experience emotional instability and negative emotions. Characteristics typically include being moody and tense.    
"""

    Label(result,
          text=terms_mean,
          foreground='green',
          bg='white',
          anchor='w',
          justify=LEFT).pack(fill=BOTH)

    result.mainloop()
예제 #2
0
def read_doc(path):
    res_disc = {
        "data": "",
        "SI": "",
        "JD": "",
        "filename": path.split("\\")[-1]
    }
    _list = []
    # for i in dir_list:
    data = ResumeParser(path).get_extracted_data()

    #print(data)

    #data = ResumeParser('C:\\Users\\prasa\\projects\\recruitment_project\\resumes\\pd.docx').get_extracted_data()

    res = {
        key: data[key]
        for key in data.keys() & {'name', 'email', 'mobile_number'}
    }
    #print(res)
    print("Name: " + str(res['name']) + '\n' + "Email: " + str(res['email']) +
          '\n' + "Mobile Number: " + str(res['mobile_number']) + '\n')
    temp = res_disc.copy()
    temp["data"] = res
    filename, ext = path.split(".")
    if ext.lower() == "docx":
        # # Load resume in word #
        resume = docx2txt.process(path)
    else:
        # Load resume in pdf #
        resume = PyPDF2.PdfFileReader(path)
        # .getDocumentInfo()
        # continue

    for j in dir_list1:
        # load job description #
        #job_desc1 = docx2txt.process("C:\\Users\\prasa\\projects\\recruitment_project\\JD\\ODA_JD1.docx")

        job_desc = docx2txt.process(os.path.join(JDpaths, j))
        temp["JD"] = os.path.join(JDpaths, j)
        #print(job_desc)

        # list of text to store resume and JD
        text = [resume, job_desc]

        from sklearn.feature_extraction.text import CountVectorizer
        cv = CountVectorizer()
        count_matrix = cv.fit_transform(text)

        from sklearn.metrics.pairwise import cosine_similarity

        #print(cosine_similarity(count_matrix))
        match = cosine_similarity(count_matrix)[0][1]
        match = match * 100
        match = round(match, 2)
        temp["SI"] = match
        _list.append(temp)  # result store in data
        print("Your resume matches around " + str(match) +
              "% of job description " + j)
        print()
        sendmail(temp)