Derive independent glossary context and protection
This commit is contained in:
@@ -136,17 +136,12 @@ func (v NoEffectValidator) Validate(_ context.Context, req Request) (Result, err
|
||||
return Result{ValidatorName: v.Name(), Decisions: decisions}, nil
|
||||
}
|
||||
|
||||
func ValidateProtectedTerms(req Request, glossaryStage bool) (Result, error) {
|
||||
vocab := NewProtectedVocabulary(req.Glossary)
|
||||
func ValidateProtectedTerms(req Request) (Result, error) {
|
||||
vocab := NewProtectedVocabulary(req.ProtectedTerms)
|
||||
decisions := make([]Decision, 0, len(req.CandidateProposal))
|
||||
for _, c := range req.CandidateProposal {
|
||||
var reason string
|
||||
if glossaryStage {
|
||||
reason = vocab.glossaryStageViolationReason(c.OriginalText, c.CorrectedText)
|
||||
} else {
|
||||
reason = vocab.violationReason(c.OriginalText, c.CorrectedText)
|
||||
}
|
||||
if reason != "" && !glossaryStage && req.ModuleKey == modulecatalog.KeySpokenWord && req.WorkingTranscript != nil {
|
||||
reason := vocab.violationReason(c.OriginalText, c.CorrectedText)
|
||||
if reason != "" && req.ModuleKey == modulecatalog.KeySpokenWord && req.WorkingTranscript != nil {
|
||||
for i := range req.WorkingTranscript.Segments {
|
||||
segment := &req.WorkingTranscript.Segments[i]
|
||||
if segment.ID != c.TargetSegmentID {
|
||||
|
||||
Reference in New Issue
Block a user