PageSourceSearch

https://careerdiary.io/assets/documentCategorizationService-CnDuug4M.js

js careerdiary.io collected 2026-10-02 01:57:22 UTC 3,436 bytes, 22 lines download raw bytes

1import{ai as i,ak as d,al as m}from"./index-DnWsV7cE.js";import"./animation-CddyXVCz.js";import"./react-vendor-CbN3pvl2.js";import"./supabase-iKSPld20.js";import"./docgen-Bp8WKBAE.js";import"./query-DPqpbKNH.js";function o(r,t){const e=r.toLowerCase();return e.includes("resume")||e.includes("cv")||e.includes("curriculum")||e.match(/^cv[_\-\s]/i)?"resumes":e.includes("certificate")||e.includes("certification")||e.includes("license")||e.includes("credential")||e.includes("award")?"certifications":e.includes("review")||e.includes("evaluation")||e.includes("feedback")||e.includes("performance")||e.includes("360")?"performance_reviews":e.includes("project")||e.includes("portfolio")||e.includes("case_study")||e.includes("case-study")||e.includes("work_sample")?"projects":e.includes("cover")||e.includes("coverletter")||e.includes("cover_letter")||e.includes("application_letter")?"cover_letters":e.includes("transcript")||e.includes("grades")||e.includes("academic_record")?"transcripts":e.includes("reference")||e.includes("recommendation")||e.includes("referral")?"references":"other"}function _(r){return{resumes:"Resumes",certifications:"Certifications",performance_reviews:"Performance Reviews",projects:"Projects",cover_letters:"Cover Letters",transcripts:"Transcripts",references:"References",other:"Other Documents"}[r]}function C(r){return{resumes:"📄",certifications:"🏆",performance_reviews:"⭐",projects:"📁",cover_letters:"✉️",transcripts:"📚",references:"👥",other:"📎"}[r]}function j(){return["resumes","certifications","performance_reviews","projects","cover_letters","transcripts","references","other"]}async function b(r,t,e){if(!r||i(r).length<50)return{category:o(t),confidence:.5};try{const c=d(),a=`You are an expert document classifier for career-related documents. Analyze the provided document content and classify it into ONE of these categories:
2- resumes: Resume, CV, or curriculum vitae
3- certifications: Certificates, licenses, credentials, awards
4- performance_reviews: Performance reviews, evaluations, feedback, 360 reviews
5- projects: Project documentation, portfolios, case studies, work samples
6- cover_letters: Cover letters, application letters
7- transcripts: Academic transcripts, grade reports
8- references: Reference letters, recommendations
9- other: Any document that doesn't fit the above categories
10
11Return ONLY a JSON object with two fields:
12{
13  "category": "the_category_name",
14  "confidence": 0.85
15}
16
17The confidence should be a number between 0 and 1 indicating how certain you are about the classification.`,u=`Analyze this document and classify it:
18
19Filename: ${t}
20
21Content:
22${r.substring(0,3e3)}`,l=await c.models.generateContent({model:m.LITE,contents:[{role:"user",parts:[{text:u}]}],config:{systemInstruction:a,temperature:.1,responseMimeType:"application/json"}}),n=i(l.text);if(!n)throw new Error("Empty response from AI");const s=JSON.parse(n);if(!["resumes","certifications","performance_reviews","projects","cover_letters","transcripts","references","other"].includes(s.category))throw new Error("Invalid category from AI");return{category:s.category,confidence:Math.min(Math.max(s.confidence||.5,0),1)}}catch(c){return console.warn("AI categorization failed, falling back to pattern matching:",c),{category:o(t),confidence:.5}}}export{o as categorizeByPattern,b as categorizeWithAI,j as getAllCategories,_ as getCategoryDisplayName,C as getCategoryIcon};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.