Files
work_dhd_back_end/test_match_simple.php

81 lines
2.6 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// 测试简化后的匹配度接口(只返回分数)
require __DIR__ . '/vendor/autoload.php';
// 岗位信息
$position = [
"position_require" => [
"学历要求" => "本科及以上",
"学位要求" => "学士及以上",
"年龄要求" => "18周岁以上、35周岁以下。",
"其他资格条件" => "适合男性。",
"专业(学科)类别" => "计算机科学与技术类,电气、电子及自动化类"
]
];
// 简历信息1不通过硬性条件年龄超限、专业不匹配
$resume1 = [
"birth_date" => "1989-03-01", // 36岁
"gender" => "",
"work_experience" => "无基层工作年限",
"education" => [
[
"education_level" => "硕士研究生",
"degree" => "硕士",
"majors_name" => "逻辑学"
],
[
"education_level" => "硕士研究生",
"degree" => "硕士",
"majors_name" => "伦理学"
]
]
];
// 简历信息2通过硬性条件
$resume2 = [
"birth_date" => "1995-03-01", // 30岁
"gender" => "",
"work_experience" => "3年基层工作年限",
"education" => [
[
"education_level" => "硕士研究生",
"degree" => "硕士",
"majors_name" => "计算机科学与技术"
]
]
];
// 加载ThinkPHP框架
$app = new think\App();
$app->initialize();
// 创建匹配服务实例
$matchService = new app\service\MatchService();
echo "========================================\n";
echo "岗位简历匹配度测试(简化版 - 只返回分数)\n";
echo "========================================\n\n";
// 测试案例1不通过硬性条件
echo "【测试案例1不通过硬性条件】\n";
echo "----------------------------------------\n";
echo "简历信息36岁专业逻辑学、伦理学\n";
$score1 = $matchService->calculateMatchScore($position, $resume1);
echo "匹配度分数: {$score1}/100分\n";
echo "说明: 硬性条件不满足年龄超限、专业不匹配返回0分\n\n";
// 测试案例2通过硬性条件
echo "【测试案例2通过硬性条件】\n";
echo "----------------------------------------\n";
echo "简历信息30岁专业计算机科学与技术有基层工作经历\n";
$score2 = $matchService->calculateMatchScore($position, $resume2);
echo "匹配度分数: {$score2}/100分\n";
echo "说明: 通过硬性条件筛选,进行软性条件评分\n\n";
echo "========================================\n";
echo "测试完成\n";
echo "========================================\n";