mail@pastecode.io avatar
a month ago
4.4 kB
% Facts - industry(Name, Description)
industry(tech, 'Technology and software development').
industry(finance, 'Finance, banking and accounting').
industry(health, 'Healthcare and medical fields').
industry(education, 'Teaching and education').
industry(marketing, 'Marketing, advertising and public relations').

% Facts - career(Industry, Name, Description, TypicalDegree, TypicalSalary)
career(tech, software_engineer, 'Designing and building software applications', bachelors, 80000).
career(tech, data_scientist, 'Analyzing data to derive insights', masters, 100000).
career(tech, product_manager, 'Overseeing the development and launch of products', bachelors, 90000).
career(finance, investment_banker, 'Facilitating investments and financial transactions', bachelors, 100000).
career(finance, accountant, 'Managing financial records and taxes', bachelors, 70000).
career(health, doctor, 'Providing medical care and treatment to patients', doctoral, 150000).
career(health, nurse, 'Assisting doctors and caring for patients', bachelors, 70000).
career(health, pharmacist, 'Dispensing medications and advising patients', doctoral, 120000).
career(education, teacher, 'Teaching students in a classroom setting', bachelors, 50000).
career(education, school_administrator, 'Managing school operations and staff', masters, 80000).
career(marketing, marketing_manager, 'Overseeing marketing campaigns and strategy', bachelors, 80000).
career(marketing, public_relations, 'Managing communications and public image', bachelors, 60000).

% Facts - skill(Name, Description) 
skill(programming, 'Writing code to build software').
skill(data_analysis, 'Analyzing data to find trends and insights').
skill(project_management, 'Planning and overseeing projects').
skill(finance, 'Knowledge of financial principles and practices').
skill(accounting, 'Maintaining financial records').
skill(medicine, 'Knowledge of diseases and treatments').
skill(patient_care, 'Providing care and support to patients').
skill(pharmacy, 'Understanding of medications and their uses').
skill(teaching, 'Ability to convey knowledge to students').
skill(leadership, 'Guiding and motivating teams').
skill(marketing_strategy, 'Developing marketing plans').
skill(communications, 'Conveying information effectively').

% Facts - requires(Career, Skill, Importance)
requires(software_engineer, programming, critical).
requires(software_engineer, project_management, high).
requires(data_scientist, data_analysis, critical).
requires(data_scientist, programming, high).
requires(product_manager, project_management, critical).
requires(product_manager, leadership, high).
requires(investment_banker, finance, critical).
requires(accountant, accounting, critical).
requires(doctor, medicine, critical).
requires(nurse, patient_care, critical).
requires(pharmacist, pharmacy, critical).
requires(teacher, teaching, critical).
requires(school_administrator, leadership, critical).
requires(marketing_manager, marketing_strategy, critical).
requires(public_relations, communications, critical).

% Rules - career_score(Career, UserSkills, Score)
career_score(Career, UserSkills, Score) :-
            (requires(Career, Skill, SkillImportance), member(Skill, UserSkills)), 
    sum_list(SkillImportances, Score).

% Rules - career_recommendation(UserSkills, Career, Score, Degree, Salary)
career_recommendation(UserSkills, Career, Score, Degree, Salary) :-
    career(_, Career, _, Degree, Salary),
    career_score(Career, UserSkills, Score).

% User interface
main :-
    write('Enter your skills (comma-separated): '),
    atomic_list_concat(SkillAtoms, ',', SkillList),
    maplist(atom_string, SkillAtoms, UserSkills),
          career_recommendation(UserSkills, Career, Score, Degree, Salary), 
    reverse(ScoredCareers, RankedCareers),
    write('Recommended career paths:'), nl,
    maplist(write_career_recommendation, RankedCareers).

write_career_recommendation(Score-Career-Degree-Salary) :-
    write('- '), write(Career), 
    write(' (match score: '), write(Score), 
    write(', typical degree: '), write(Degree),
    write(', typical salary: $'), write(Salary), write(')'), nl.

% Importance score conversion    
Leave a Comment