fix : 修正文本提取工具,优化工作经验解析
This commit is contained in:
@@ -93,7 +93,35 @@ export const useAudioSpeak = (config = {}) => {
|
|||||||
// 如果不是 "XXXXX-XXXXX元/月" 格式,保持原样
|
// 如果不是 "XXXXX-XXXXX元/月" 格式,保持原样
|
||||||
}
|
}
|
||||||
|
|
||||||
return `第 ${index + 1} 个岗位,岗位名称是:${job.jobTitle},公司是:${job.companyName},薪资:${salaryText},地点:${job.location},学历要求:${job.education},经验要求:${job.experience}。`;
|
// 处理经验要求格式
|
||||||
|
let experienceText = job.experience;
|
||||||
|
if (experienceText) {
|
||||||
|
// 匹配 "X-X年" 格式,如 "1-3年"、"5-10年"
|
||||||
|
const expRangeMatch = experienceText.match(/(\d+)-(\d+)年/);
|
||||||
|
if (expRangeMatch) {
|
||||||
|
const minExp = parseInt(expRangeMatch[1], 10);
|
||||||
|
const maxExp = parseInt(expRangeMatch[2], 10);
|
||||||
|
experienceText = `${minExp}到${maxExp}年`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 还可以处理其他常见格式
|
||||||
|
else if (experienceText.includes('年以下')) {
|
||||||
|
// 如 "3年以下"
|
||||||
|
experienceText = experienceText.replace('年以下', '年以下');
|
||||||
|
} else if (experienceText.includes('年以上')) {
|
||||||
|
// 如 "5年以上"
|
||||||
|
experienceText = experienceText.replace('年以上', '年以上');
|
||||||
|
} else if (experienceText === '不限' || experienceText === '无经验要求') {
|
||||||
|
experienceText = '经验不限';
|
||||||
|
}
|
||||||
|
// 其他格式保持原样
|
||||||
|
}
|
||||||
|
|
||||||
|
// 同样可以处理学历要求(如果需要的话)
|
||||||
|
let educationText = job.education;
|
||||||
|
// 这里可以添加学历格式的转换逻辑
|
||||||
|
|
||||||
|
return `第 ${index + 1} 个岗位,岗位名称是:${job.jobTitle},公司是:${job.companyName},薪资:${salaryText},地点:${job.location},学历要求:${educationText},经验要求:${experienceText}。`;
|
||||||
});
|
});
|
||||||
|
|
||||||
const finalTextParts = [];
|
const finalTextParts = [];
|
||||||
|
|||||||
Reference in New Issue
Block a user