Remove confidence scoring and refine correction prompts

This commit is contained in:
2026-11-11 17:05:52 +00:00
parent bbf89bb4f5
commit d155bf4cb3
92 changed files with 448 additions and 786 deletions

View File

@@ -10,7 +10,6 @@ func TestCorrectionProposalValidate_Valid(t *testing.T) {
TargetSegmentID: 42,
OriginalText: "gestures",
CorrectedText: "Jesters",
Confidence: 0.95,
}
if err := proposal.Validate(); err != nil {
@@ -23,7 +22,6 @@ func TestCorrectionProposalValidate_InvalidEmptyOriginalText(t *testing.T) {
TargetSegmentID: 42,
OriginalText: "",
CorrectedText: "Jesters",
Confidence: 0.95,
}
err := proposal.Validate()
@@ -40,7 +38,6 @@ func TestCorrectionProposalValidate_AllowsEmptyCorrectedText(t *testing.T) {
TargetSegmentID: 42,
OriginalText: "gestures",
CorrectedText: "",
Confidence: 0.95,
}
if err := proposal.Validate(); err != nil {
@@ -49,35 +46,17 @@ func TestCorrectionProposalValidate_AllowsEmptyCorrectedText(t *testing.T) {
}
func TestCorrectionProposalValidate_AllowsWhitespaceOriginalText(t *testing.T) {
proposal := CorrectionProposal{TargetSegmentID: 42, OriginalText: " ", CorrectedText: " ", Confidence: 0.95}
proposal := CorrectionProposal{TargetSegmentID: 42, OriginalText: " ", CorrectedText: " "}
if err := proposal.Validate(); err != nil {
t.Fatalf("expected whitespace span to be valid, got %v", err)
}
}
func TestCorrectionProposalValidate_InvalidConfidence(t *testing.T) {
proposal := CorrectionProposal{
TargetSegmentID: 42,
OriginalText: "gestures",
CorrectedText: "Jesters",
Confidence: 1.1,
}
err := proposal.Validate()
if err == nil {
t.Fatal("expected validation error, got nil")
}
if err.Error() != "proposal confidence must be between 0.0 and 1.0" {
t.Fatalf("unexpected error: %v", err)
}
}
func TestCorrectionProposalValidate_InvalidSegmentID(t *testing.T) {
proposal := CorrectionProposal{
TargetSegmentID: 0,
OriginalText: "gestures",
CorrectedText: "Jesters",
Confidence: 0.95,
}
err := proposal.Validate()
@@ -147,7 +126,6 @@ func TestEnrichedCorrectionProposalJSONIncludesMetadata(t *testing.T) {
TargetSegmentID: 7,
OriginalText: "teh",
CorrectedText: "the",
Confidence: 0.8,
},
ProposalMetadata: ProposalMetadata{
ProposalIndex: 1,
@@ -162,7 +140,7 @@ func TestEnrichedCorrectionProposalJSONIncludesMetadata(t *testing.T) {
t.Fatalf("marshal failed: %v", err)
}
const expected = `{"id":7,"original_text":"teh","corrected_text":"the","confidence":0.8,"proposal_index":1,"module_key":"grammar","module_instance":"grammar_1","section_index":3}`
const expected = `{"id":7,"original_text":"teh","corrected_text":"the","proposal_index":1,"module_key":"grammar","module_instance":"grammar_1","section_index":3}`
if string(b) != expected {
t.Fatalf("unexpected json\nexpected: %s\nactual: %s", expected, string(b))
}