nfrax logonfrax

Infrastructure that just works. Ship products, not boilerplate.

Frameworks

  • svc-infra
  • ai-infra
  • fin-infra
  • robo-infra

Resources

  • Getting Started
  • What's New
  • Contributing

Community

  • GitHub

© 2026 nfrax. All rights reserved.

nfrax logonfrax
Start HereWhat's New
GitHub
fin-infra / API Reference

CategorizationEngine

from fin_infra.categorization.engine import CategorizationEngine
View source
fin_infra.categorization.engine

Hybrid categorization engine. Uses 4-layer approach for high accuracy and performance: 1. Exact match (dictionary) 2. Regex patterns 3. Machine learning (sklearn Naive Bayes) 4. LLM fallback (ai-infra) - V2 feature

Args

enable_ml: Enable ML fallback (Layer 3) enable_llm: Enable LLM fallback (Layer 4) confidence_threshold: Minimum confidence for ML/LLM trigger (default 0.6) model_path: Path to pre-trained ML model llm_categorizer: LLMCategorizer instance (Layer 4)

Constructor
CategorizationEngine(enable_ml: bool = False, enable_llm: bool = False, confidence_threshold: float = 0.6, model_path: Path | None = None, llm_categorizer: Optional[LLMCategorizer] = None)
ParameterTypeDefaultDescription
enable_mlboolFalse—
enable_llmboolFalse—
confidence_thresholdfloat0.6—
model_pathPath |NoneNone—
llm_categorizerOptional[LLMCategorizer]None—

Methods

On This Page

Constructoradd_rulecategorizeget_stats