Add D&D location occurrence validators

This commit is contained in:
2026-08-04 00:33:39 +00:00
parent dd61a4efda
commit a168c13b85
14 changed files with 1034 additions and 3 deletions

View File

@@ -16,7 +16,8 @@ import (
const (
Key = "extract/dnd/locations/source_relatedness"
WarningReasonCode = "location_not_near_source"
policy = "dnd.locations.validator.source_relatedness.v1"
OmittedReasonCode = "location_relatedness_warnings_omitted"
policy = "dnd.locations.validator.source_relatedness.v2"
)
type Options struct{}
@@ -60,7 +61,7 @@ func (v *Validator) Validate(_ context.Context, req contracts.TypedValidationReq
Message: fmt.Sprintf("Location %s was not found in cited source text", diagnostics.Quote(location.Name)),
})
}
return contracts.ValidationResult{Approved: true, Warnings: warnings}, nil
return contracts.ValidationResult{Approved: true, Warnings: diagnostics.LimitWarnings(warnings, "locations", OmittedReasonCode)}, nil
}
func Spec() pipeline.ValidatorSpec {