Skip to main content

Module classify

Module classify 

Source
Expand description

Deterministic classification (decided.core.classification), per PORT-CONTRACT.d/04 §2.

  • synonym-aware section mapping is per-spec (_mapped), a set;
  • scoring floats replicate the exact Python arithmetic (len_req + 0.5 * len_rec, then divide);
  • the sort is sort(key=(fit, len(matched_required)), reverse=True) — stable, ties preserve ARTIFACT_SPECS order (reverse flips key order but NOT equal-key runs);
  • confidence = round(fit, 2) — banker’s rounding on the true double (pycompat::py_round).

Structs§

Classification
The chosen artifact type for a document (or Unknown).
TypeScore
How well a document fits one artifact type (TypeScore).

Constants§

CONFIDENCE_THRESHOLD

Functions§

classify
classify(product).
missing_sections
missing_sections(product, spec) -> (missing_required, missing_recommended) in schema declaration order, synonym-aware.
score_artifacts
score_artifacts(product): scores best-fit-first with the exact Python sort semantics.