MCPcopy Create free account
hub / github.com/917Dhj/DeepPaperNote / infer_domain_label

Function infer_domain_label

scripts/common.py:1439–1464  ·  view source on GitHub ↗
(title: str, abstract: str = "")

Source from the content-addressed store, hash-verified

1437
1438
1439def infer_domain_label(title: str, abstract: str = "") -> str:
1440 lower = normalize_whitespace(f"{title} {abstract}").lower()
1441 rules = load_domain_rules()
1442 scored: list[tuple[int, str]] = []
1443 for rule in rules["domains"]:
1444 score = _score_domain_for_inference(rule, lower, fallback=False)
1445 if score > 0:
1446 scored.append((score, _domain_route_label(rule)))
1447 if scored:
1448 scored.sort(key=lambda item: (-item[0], item[1]))
1449 return scored[0][1]
1450
1451 for rule in rules["fallback_domains"]:
1452 score = _score_domain_for_inference(rule, lower, fallback=True)
1453 if score > 0:
1454 scored.append((score, _domain_route_label(rule)))
1455 if scored:
1456 scored.sort(key=lambda item: (-item[0], item[1]))
1457 return scored[0][1]
1458
1459 paper_type, _ = infer_paper_type(title, abstract)
1460 if paper_type == "clinical_or_psychology_empirical":
1461 return "医疗健康"
1462 if paper_type == "AI_method":
1463 return "机器学习"
1464 return "未分类"
1465
1466
1467def is_probable_paper_folder(path: Path) -> bool:

Calls 5

normalize_whitespaceFunction · 0.85
load_domain_rulesFunction · 0.85
_domain_route_labelFunction · 0.85
infer_paper_typeFunction · 0.85