mirror of
https://github.com/storytold/wordcraft.git
synced 2026-10-24 10:27:44 -06:00
proof: drop U+FE0F from FORBIDDENWORD and NOSUGGEST flags too
Review follow-up: the directives that name one flag read the same emoji form, so they now skip the variation selector like PFX/SFX and stem flags. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
fd91a78e71
commit
40ae6ac08c
@@ -295,7 +295,7 @@ fn parse_aff(aff: &str) -> Result<Rules, String> {
|
||||
}
|
||||
}
|
||||
directive @ ("FORBIDDENWORD" | "NOSUGGEST") => {
|
||||
let mut it = at(1).chars();
|
||||
let mut it = at(1).chars().filter(|&c| c != EMOJI_SELECTOR);
|
||||
match (it.next(), it.next()) {
|
||||
(Some(c), None) if !c.is_whitespace() => {
|
||||
if directive == "FORBIDDENWORD" {
|
||||
@@ -1098,6 +1098,15 @@ pub(crate) mod tests {
|
||||
assert!(!d.flag_chars.contains(&EMOJI_SELECTOR), "the selector is not a flag");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn emoji_forbiddenword_and_nosuggest_flags_load() {
|
||||
// The same selector after the flag of the directives that name one flag.
|
||||
let aff = "SET UTF-8\nFLAG UTF-8\nFORBIDDENWORD \u{260e}\u{fe0f}\nNOSUGGEST \u{1f6ab}\u{fe0f}\n";
|
||||
let d = AffixDict::from_hunspell(aff, "3\nbanco\nbanko/\u{260e}\u{fe0f}\nbancu/\u{1f6ab}\u{fe0f}\n", &[]).unwrap();
|
||||
assert!(d.contains("banco") && d.contains("bancu"));
|
||||
assert!(!d.contains("banko"), "a stem with the FORBIDDENWORD flag is not a word");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn more_than_64_distinct_flags_load() {
|
||||
// VERO pt_BR uses 106 distinct flags (FLAG UTF-8). Build one with every basic Latin
|
||||
|
||||
Reference in New Issue
Block a user