generated from kgod/ai-review-template
自内部仓库剥离深度优化与 RAG 知识库后的交付版本: - Builder 对话式简历生成(FSM + 意图路由 LLM 兜底增强) - 条目级轻度优化:事实覆盖门禁 + STAR/bullet 修复链,功能/简介/成果与技术栈同级保护 - 简历导入:DOCX/PDF 解析、结构归一、手机号脱敏 - PostgreSQL 运行时 + Alembic 迁移链 Co-Authored-By: Claude <noreply@anthropic.com>
145 lines
4.1 KiB
Python
145 lines
4.1 KiB
Python
"""Position-anchored dimension weights for deterministic gap evaluation."""
|
|
|
|
from __future__ import annotations
|
|
|
|
|
|
_OPTIONAL_DIM_DEFAULTS = {
|
|
"project_context": 1,
|
|
"business_context": 1,
|
|
"academic_result": 1,
|
|
"project_or_activity": 1,
|
|
"team_scope": 1,
|
|
"organization_scope": 1,
|
|
}
|
|
|
|
_WEIGHT_TABLE: dict[str, dict[str, int]] = {
|
|
"tech": {
|
|
"personal_contribution": 3,
|
|
"responsibility_scope": 2,
|
|
"method_or_technology": 3,
|
|
"business_action": 1,
|
|
"outcome_or_delivery": 2,
|
|
"quantified_outcome": 2,
|
|
"coursework_or_practice": 2,
|
|
"relevant_capability": 2,
|
|
"work_or_solution": 3,
|
|
"activity_execution": 1,
|
|
"collaboration_scope": 1,
|
|
**_OPTIONAL_DIM_DEFAULTS,
|
|
},
|
|
"data": {
|
|
"personal_contribution": 2,
|
|
"responsibility_scope": 2,
|
|
"method_or_technology": 3,
|
|
"business_action": 2,
|
|
"outcome_or_delivery": 2,
|
|
"quantified_outcome": 3,
|
|
"coursework_or_practice": 2,
|
|
"relevant_capability": 2,
|
|
"work_or_solution": 2,
|
|
"activity_execution": 1,
|
|
"collaboration_scope": 1,
|
|
**_OPTIONAL_DIM_DEFAULTS,
|
|
},
|
|
"product": {
|
|
"personal_contribution": 3,
|
|
"responsibility_scope": 2,
|
|
"method_or_technology": 1,
|
|
"business_action": 3,
|
|
"outcome_or_delivery": 3,
|
|
"quantified_outcome": 2,
|
|
"coursework_or_practice": 1,
|
|
"relevant_capability": 2,
|
|
"work_or_solution": 2,
|
|
"activity_execution": 2,
|
|
"collaboration_scope": 3,
|
|
**{**_OPTIONAL_DIM_DEFAULTS, "business_context": 2},
|
|
},
|
|
"design": {
|
|
"personal_contribution": 3,
|
|
"responsibility_scope": 2,
|
|
"method_or_technology": 2,
|
|
"business_action": 1,
|
|
"outcome_or_delivery": 3,
|
|
"quantified_outcome": 1,
|
|
"coursework_or_practice": 2,
|
|
"relevant_capability": 2,
|
|
"work_or_solution": 2,
|
|
"activity_execution": 1,
|
|
"collaboration_scope": 2,
|
|
**_OPTIONAL_DIM_DEFAULTS,
|
|
},
|
|
"business": {
|
|
"personal_contribution": 2,
|
|
"responsibility_scope": 3,
|
|
"method_or_technology": 1,
|
|
"business_action": 3,
|
|
"outcome_or_delivery": 3,
|
|
"quantified_outcome": 2,
|
|
"coursework_or_practice": 1,
|
|
"relevant_capability": 2,
|
|
"work_or_solution": 1,
|
|
"activity_execution": 2,
|
|
"collaboration_scope": 3,
|
|
**{**_OPTIONAL_DIM_DEFAULTS, "business_context": 2},
|
|
},
|
|
"default": {
|
|
"personal_contribution": 2,
|
|
"responsibility_scope": 2,
|
|
"method_or_technology": 2,
|
|
"business_action": 2,
|
|
"outcome_or_delivery": 2,
|
|
"quantified_outcome": 2,
|
|
"coursework_or_practice": 1,
|
|
"relevant_capability": 1,
|
|
"work_or_solution": 2,
|
|
"activity_execution": 1,
|
|
"collaboration_scope": 1,
|
|
**_OPTIONAL_DIM_DEFAULTS,
|
|
},
|
|
}
|
|
|
|
_ALIASES: dict[str, str] = {
|
|
"后端": "tech",
|
|
"前端": "tech",
|
|
"工程师": "tech",
|
|
"开发": "tech",
|
|
"算法": "tech",
|
|
"测试": "tech",
|
|
"运维": "tech",
|
|
"数据": "data",
|
|
"分析师": "data",
|
|
"bi": "data",
|
|
"产品": "product",
|
|
"运营": "product",
|
|
"增长": "product",
|
|
"设计": "design",
|
|
"ui": "design",
|
|
"ux": "design",
|
|
"视觉": "design",
|
|
"市场": "business",
|
|
"销售": "business",
|
|
"财务": "business",
|
|
"审计": "business",
|
|
"人力": "business",
|
|
"行政": "business",
|
|
"客户成功": "business",
|
|
"咨询": "business",
|
|
}
|
|
|
|
|
|
def position_family(target_position: str | None) -> str:
|
|
"""Return the deterministic rubric family for a confirmed target position."""
|
|
text = str(target_position or "").strip().casefold()
|
|
if not text:
|
|
return "default"
|
|
for keyword, family in _ALIASES.items():
|
|
if keyword in text:
|
|
return family
|
|
return "default"
|
|
|
|
|
|
def dimension_weights(target_position: str | None) -> dict[str, int]:
|
|
"""Return a copy so callers cannot mutate the module-level weight matrix."""
|
|
return dict(_WEIGHT_TABLE[position_family(target_position)])
|