Validate internal decisions and reconcile exact model references
This commit is contained in:
@@ -54,3 +54,21 @@ func (r Request) Preview(candidate proposals.EnrichedCorrectionProposal) proposa
|
||||
}
|
||||
return preview
|
||||
}
|
||||
|
||||
// AcceptsIndependentCandidate decides which evidence can be submitted when
|
||||
// repair needs findings from each applicable validator.
|
||||
func (r Request) AcceptsIndependentCandidate(validatorName string, modelDriven bool, candidate proposals.EnrichedCorrectionProposal) bool {
|
||||
hasSpan := candidate.OriginalText != ""
|
||||
switch validatorName {
|
||||
case "proposal_shape":
|
||||
return true
|
||||
case "no_effect":
|
||||
return hasSpan
|
||||
case "original_text_presence":
|
||||
return hasSpan && candidate.TargetSegmentID > 0
|
||||
case "protected_terms", "non_empty_resulting_segment":
|
||||
return r.Preview(candidate).HasResult()
|
||||
default:
|
||||
return !modelDriven || r.Preview(candidate).Applicable
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user