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

Function _rules_for_label

scripts/common.py:1407–1419  ·  view source on GitHub ↗
(
    rules: dict[str, list[dict[str, Any]]],
    label: str,
)

Source from the content-addressed store, hash-verified

1405
1406
1407def _rules_for_label(
1408 rules: dict[str, list[dict[str, Any]]],
1409 label: str,
1410) -> list[tuple[str, dict[str, Any]]]:
1411 normalized_label = _normalized_domain_label(label)
1412 matches: list[tuple[str, dict[str, Any]]] = []
1413 for section in DOMAIN_SECTIONS:
1414 for rule in rules[section]:
1415 route_label = _normalized_domain_label(_domain_route_label(rule))
1416 terms = [_normalized_domain_label(term) for term in _domain_match_terms(rule)]
1417 if normalized_label == route_label or normalized_label in terms:
1418 matches.append((section, rule))
1419 return matches
1420
1421
1422def _score_domain_for_inference(rule: dict[str, Any], text: str, *, fallback: bool) -> int:

Callers 1

domain_name_scoreFunction · 0.85

Calls 3

_normalized_domain_labelFunction · 0.85
_domain_route_labelFunction · 0.85
_domain_match_termsFunction · 0.85

Tested by

no test coverage detected