Classify source relatedness as data-quality advisories
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// Package sourcerelatedness warns when scene prose has no lexical grounding.
|
||||
// Package sourcerelatedness reports advisory findings when scene prose has no lexical grounding.
|
||||
package sourcerelatedness
|
||||
|
||||
import (
|
||||
@@ -16,10 +16,9 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
Key = "extract/dnd/scene-descriptions/source_relatedness"
|
||||
WarningReasonCode = "scene_description_not_near_source"
|
||||
OmittedReasonCode = "scene_description_relatedness_warnings_omitted"
|
||||
policy = "dnd.scene_descriptions.validator.source_relatedness.v1"
|
||||
Key = "extract/dnd/scene-descriptions/source_relatedness"
|
||||
ReasonCode = "scene_description_not_near_source"
|
||||
policy = "dnd.scene_descriptions.validator.source_relatedness.v1"
|
||||
)
|
||||
|
||||
var stopwords = map[string]struct{}{
|
||||
@@ -66,10 +65,7 @@ func (v *Validator) Validate(_ context.Context, req contracts.TypedValidationReq
|
||||
warnings = append(warnings, warning(index, "summary"))
|
||||
}
|
||||
}
|
||||
return contracts.ValidationResult{
|
||||
Approved: true,
|
||||
Warnings: diagnostics.LimitWarnings(warnings, "scenes", OmittedReasonCode),
|
||||
}, nil
|
||||
return diagnostics.DataQualityResult(warnings)
|
||||
}
|
||||
|
||||
func tokenSet(value string) map[string]struct{} {
|
||||
@@ -105,7 +101,7 @@ func significant(token string) bool {
|
||||
func warning(index int, field string) contracts.Warning {
|
||||
return contracts.Warning{
|
||||
Scope: fmt.Sprintf("scenes[%d].%s", index, field),
|
||||
ReasonCode: WarningReasonCode,
|
||||
ReasonCode: ReasonCode,
|
||||
Message: "scene description " + field + " has no significant token in cited source text",
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user