Remove confidence scoring and refine correction prompts
This commit is contained in:
@@ -8,7 +8,6 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"gitea.maximumdirect.net/eric/audita/v3/internal/core/config"
|
||||
domain "gitea.maximumdirect.net/eric/audita/v3/internal/core/glossary"
|
||||
"gitea.maximumdirect.net/eric/audita/v3/internal/core/schema"
|
||||
"gitea.maximumdirect.net/eric/audita/v3/internal/framework/contracts"
|
||||
@@ -76,7 +75,6 @@ func TestSpokenWordModuleValidatorChain(t *testing.T) {
|
||||
"proposal_shape",
|
||||
"no_effect",
|
||||
"original_text_presence",
|
||||
"confidence_threshold",
|
||||
"protected_terms",
|
||||
"non_empty_resulting_segment",
|
||||
"editorial_review",
|
||||
@@ -93,7 +91,7 @@ func TestSpokenWordModuleProposeMapsCorrectionsAndWritesDiagnostics(t *testing.T
|
||||
responses: []proposal_generation.StructuredCorrectionSet{
|
||||
{
|
||||
Corrections: []proposal_generation.StructuredCorrectionProposal{
|
||||
{SegmentReference: 1, OriginalText: "I I think", CorrectedText: "I think", Confidence: 0.94},
|
||||
{SegmentReference: 1, OriginalText: "I I think", CorrectedText: "I think"},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -150,51 +148,6 @@ func TestSpokenWordModuleProposeMapsCorrectionsAndWritesDiagnostics(t *testing.T
|
||||
}
|
||||
}
|
||||
|
||||
func TestSpokenWordConfidenceThresholdIsUsed(t *testing.T) {
|
||||
module, err := New()
|
||||
if err != nil {
|
||||
t.Fatalf("New error: %v", err)
|
||||
}
|
||||
var thresholdValidator contracts.Validator
|
||||
for _, v := range module.Validators() {
|
||||
if v.Name() == "confidence_threshold" {
|
||||
thresholdValidator = v
|
||||
break
|
||||
}
|
||||
}
|
||||
if thresholdValidator == nil {
|
||||
t.Fatal("expected confidence_threshold validator")
|
||||
}
|
||||
|
||||
result, err := thresholdValidator.Validate(context.Background(), validators.Request{
|
||||
Settings: config.Stage{ConfidenceThreshold: 0.95},
|
||||
ModuleKey: "spoken_word",
|
||||
CandidateProposal: []proposals.EnrichedCorrectionProposal{
|
||||
{
|
||||
CorrectionProposal: proposals.CorrectionProposal{
|
||||
TargetSegmentID: 1,
|
||||
OriginalText: "I I think",
|
||||
CorrectedText: "I think",
|
||||
Confidence: 0.94,
|
||||
},
|
||||
ProposalMetadata: proposals.ProposalMetadata{ProposalIndex: 0, ModuleKey: "spoken_word", ModuleInstance: "spoken_word"},
|
||||
},
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("validate error: %v", err)
|
||||
}
|
||||
if len(result.Decisions) != 1 {
|
||||
t.Fatalf("expected one decision, got %+v", result.Decisions)
|
||||
}
|
||||
if result.Decisions[0].Approved {
|
||||
t.Fatalf("expected rejection under spoken_word threshold, got %+v", result.Decisions[0])
|
||||
}
|
||||
if result.Decisions[0].ReasonCode != validators.ReasonLowConfidence {
|
||||
t.Fatalf("expected low confidence reason, got %+v", result.Decisions[0])
|
||||
}
|
||||
}
|
||||
|
||||
func TestSpokenWordProtectedGlossaryTermBehaviorRejectsUnsafeCorrection(t *testing.T) {
|
||||
module, err := New()
|
||||
if err != nil {
|
||||
@@ -226,7 +179,6 @@ func TestSpokenWordProtectedGlossaryTermBehaviorRejectsUnsafeCorrection(t *testi
|
||||
TargetSegmentID: 1,
|
||||
OriginalText: "Jesters",
|
||||
CorrectedText: "gestures",
|
||||
Confidence: 0.99,
|
||||
},
|
||||
ProposalMetadata: proposals.ProposalMetadata{ProposalIndex: 0, ModuleKey: "spoken_word", ModuleInstance: "spoken_word"},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user