Skip to main content

Crate ainl_semantic_tagger

Crate ainl_semantic_tagger 

Source
Expand description

Deterministic, heuristic-only semantic tagging for AINL / ArmaraOS.

No ML, embeddings, or graph-store dependency.

Structs§

CorrectionRegexes
Compiled regex bundle for correction extraction.
SemanticTag

Enums§

TagNamespace

Constants§

BEHAVIOR_ADDING_CAVEATS
BEHAVIOR_OVEREXPLAINING
CORRECTION_AVOID_BULLETS
CORRECTION_AVOID_EMOJIS
PREFERENCE_BREVITY
PREFERENCE_DETAIL
PREFERENCE_DIRECTNESS
PREFERENCE_EXAMPLES
TONE_FORMAL
TONE_INFORMAL

Functions§

correction_regexes
Lazily compiled correction regexes (identical patterns to legacy persona_signals).
extract_correction_behavior
Stage-1 triggers + stage-2 regex normalization, mapped to canonical SemanticTag values.
infer_brevity_preference
Detects an explicit brevity preference (including legacy EXPLICIT_BREVITY substring cues).
infer_formality
Returns tone:formal or tone:informal when the score is outside the ambiguous band (0.38, 0.62); otherwise None. Confidence is always 0.75 on a match.
infer_topic_tags
Deterministic keyword tagging for broad topics. One tag per topic slug; confidence is the max across that slug’s keyword hits (0.85 exact / phrase, 0.70 substring for single-token keys).
quantize_confidence
Quantize confidence to [0, 100] for equality and hashing (~two decimal places of resolution). Non-finite values (NaN, ±∞) map to 0 so they cannot poison Hash implementations.
tag_tool_names
Maps tool name strings to canonical TagNamespace::Tool tags. Unknown tools are retained with a sanitized slug and confidence 0.5.
tag_turn
Tags user + assistant text and tool metadata; deduplicates by (namespace, value).
tag_user_message
Runs all preference detectors; multiple matches return multiple tags.