fix(reversal): extend punctuation handling
Add !, ;, and , to splitTrailingPunct and matchPunctuation. Previously only ..., ?, and : were recognised. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
9474edde6d
commit
c3b96a4ce1
1 changed files with 7 additions and 1 deletions
|
|
@ -539,7 +539,7 @@ func splitTrailingPunct(s string) (string, string) {
|
||||||
// Check single-char trailing punctuation.
|
// Check single-char trailing punctuation.
|
||||||
if len(s) > 1 {
|
if len(s) > 1 {
|
||||||
last := s[len(s)-1]
|
last := s[len(s)-1]
|
||||||
if last == '?' || last == ':' {
|
if last == '?' || last == ':' || last == '!' || last == ';' || last == ',' {
|
||||||
return s[:len(s)-1], string(last)
|
return s[:len(s)-1], string(last)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -554,8 +554,14 @@ func matchPunctuation(punct string) (string, bool) {
|
||||||
return "progress", true
|
return "progress", true
|
||||||
case "?":
|
case "?":
|
||||||
return "question", true
|
return "question", true
|
||||||
|
case "!":
|
||||||
|
return "exclamation", true
|
||||||
case ":":
|
case ":":
|
||||||
return "label", true
|
return "label", true
|
||||||
|
case ";":
|
||||||
|
return "separator", true
|
||||||
|
case ",":
|
||||||
|
return "comma", true
|
||||||
}
|
}
|
||||||
return "", false
|
return "", false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue