src.dackar.RCA.ner.hybrid_ner.models

Classes

Document

Represents a single reliability text document (condition report, work order, etc.).

SourceHit

Provenance record for how a candidate span was generated.

LabelHypothesis

A proposed label for a candidate span before final resolution.

CandidateSpan

A proposed entity mention span before final decision.

ResolvedSpan

A finalized span after conflict resolution / compatibility enforcement.

Decision

Records how one or more CandidateSpan(s) are resolved into final output spans.

RelationProposal

Optional suggested relation between resolved spans. This is not required for v0.1,

PipelineResult

Final result for a document.

Module Contents

class src.dackar.RCA.ner.hybrid_ner.models.Document[source]

Represents a single reliability text document (condition report, work order, etc.).

Offsets are always defined on text (the original authoritative string). Normalization can be added later using normalized_text + offset_map.

doc_id: str[source]
text: str[source]
meta: Dict[str, Any][source]
normalized_text: str | None = None[source]
offset_map: Any = None[source]
class src.dackar.RCA.ner.hybrid_ner.models.SourceHit[source]

Provenance record for how a candidate span was generated.

Examples

  • source_type=”regex”, source_id=”REGEX_FAIL_START”

  • source_type=”gazetteer_exact”, source_id=”deg_mech_list”

  • source_type=”noun_chunk”, source_id=”spacy_np”

source_type: str[source]
source_id: str[source]
score: float | None = None[source]
details: Dict[str, Any][source]
class src.dackar.RCA.ner.hybrid_ner.models.LabelHypothesis[source]

A proposed label for a candidate span before final resolution.

group is typically filled by schema lookup (label->group). score can be used as a prior confidence or later overwritten by an ML classifier.

label: str[source]
group: str | None = None[source]
score: float | None = None[source]
rationale: str | None = None[source]
class src.dackar.RCA.ner.hybrid_ner.models.CandidateSpan[source]

A proposed entity mention span before final decision.

Fields:
  • start/end: character offsets into Document.text

  • text: cached substring for convenience

  • sources: provenance (where did this candidate come from)

  • proposed_labels: potentially multiple, potentially conflicting

span_id: str[source]
doc_id: str[source]
start: int[source]
end: int[source]
text: str[source]
sources: List[SourceHit] = [][source]
proposed_labels: List[LabelHypothesis] = [][source]
attributes: Dict[str, Any][source]
is_nested_allowed: bool = True[source]
class src.dackar.RCA.ner.hybrid_ner.models.ResolvedSpan[source]

A finalized span after conflict resolution / compatibility enforcement.

labels may contain multiple labels only if allowed by schema/rules (e.g., G5+G6).

span_id: str[source]
doc_id: str[source]
start: int[source]
end: int[source]
text: str[source]
labels: List[str][source]
groups: List[str][source]
provenance: Dict[str, Any][source]
class src.dackar.RCA.ner.hybrid_ner.models.Decision[source]

Records how one or more CandidateSpan(s) are resolved into final output spans.

action:
  • “accept”: accept as-is (possibly with refined label list)

  • “reject”: discard

  • “split”: output_spans contains >1 span

  • “nest”: output contains nested spans

  • “defer”: unresolved; keep for ML or human review

decision_id: str[source]
doc_id: str[source]
input_span_ids: List[str][source]
output_spans: List[ResolvedSpan][source]
action: str[source]
triggered_rule_ids: List[str] = [][source]
notes: List[str] = [][source]
confidence: float | None = None[source]
class src.dackar.RCA.ner.hybrid_ner.models.RelationProposal[source]

Optional suggested relation between resolved spans. This is not required for v0.1, but the compatibility schema can recommend link types like:

  • “causes”, “affects”, “made_of”, “has_outcome”

rel_id: str[source]
doc_id: str[source]
relation_type: str[source]
head_span_id: str[source]
tail_span_id: str[source]
confidence: float | None = None[source]
evidence: Dict[str, Any][source]
triggered_rule_ids: List[str] = [][source]
class src.dackar.RCA.ner.hybrid_ner.models.PipelineResult[source]
Final result for a document.
  • decisions: full traceability of how spans were resolved

  • entities: flattened accepted spans (for typical downstream use)

  • relations: optional relation proposals

  • diagnostics: counters/timings/debug info

doc_id: str[source]
decisions: List[Decision][source]
entities: List[ResolvedSpan][source]
relations: List[RelationProposal][source]
diagnostics: Dict[str, Any][source]