Align prompts and strengthen validation context

This commit is contained in:
2026-09-25 12:23:10 +00:00
parent 3eb73e70fc
commit 325c4ea7d3
23 changed files with 329 additions and 133 deletions

View File

@@ -186,3 +186,22 @@ func validateCapitalizationTransitions(beforeByID, afterByID map[int][]protected
}
return ""
}
// preservesRepeatedIdentities permits a spoken-word proposal to reduce repeated
// mentions, but not remove an identity or replace its surviving spelling.
// Editorial and meaning validators still decide whether the cleanup is warranted.
func (v ProtectedVocabulary) preservesRepeatedIdentities(before, after string) bool {
original := v.occurrencesByIdentity(before)
result := v.occurrencesByIdentity(after)
reduced := false
for identity, occurrences := range original {
remaining := result[identity]
if len(remaining) == 0 {
return false
}
if len(remaining) < len(occurrences) {
reduced = true
}
}
return reduced && validateCapitalizationTransitions(original, result) == ""
}