From 294e2c7c5989eb14b4ee0704c8462610d5acc65c Mon Sep 17 00:00:00 2001 From: isamu Date: Mon, 30 Nov 2026 07:43:24 +0900 Subject: [PATCH 1/2] fix: number-style-consistency skips a figure glued to a name and one opening a log entry Co-Authored-By: Claude Opus 5.5 --- text/packages/chaff/src/detectors/number-style.ts | 12 +++++++++++- text/test/test_number_style.ts | 3 +++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/text/packages/chaff/src/detectors/number-style.ts b/text/packages/chaff/src/detectors/number-style.ts index 01d37a8a7..e36771e98 100644 --- a/text/packages/chaff/src/detectors/number-style.ts +++ b/text/packages/chaff/src/detectors/number-style.ts @@ -223,6 +223,15 @@ const isCountedNoun = (token: Token | undefined, figureNouns: readonly string[]) const endsInNameWord = (before: string, nameWords: readonly string[]): boolean => nameWords.length > 0 && new RegExp(`(? words.countWords.length || index === 0 || !isCountedNoun(tokens[index + 1], words.figureNouns)) return []; - if (endsInNameWord(sentence.text.slice(0, token.span.start - sentence.span.start), words.nameWords)) return []; + const before = sentence.text.slice(0, token.span.start - sentence.span.start); + if (endsInNameWord(before, words.nameWords) || GLUED_TO_NAME.test(before) || OPENS_LOG_ENTRY.test(before)) return []; const style = /^\d+$/u.test(token.surface) ? "digits" : "words"; return [{ kind: value < LARGE_FROM ? "count-small" : "count-large", style, written: token.surface, offset: token.span.start }]; }); diff --git a/text/test/test_number_style.ts b/text/test/test_number_style.ts index 0a7f72b82..822d86bec 100644 --- a/text/test/test_number_style.ts +++ b/text/test/test_number_style.ts @@ -136,6 +136,9 @@ describe("numberMarksIn: English", () => { ["The fund paid $12500 to 3 members.", ["grouping:plain:12500", "count-small:digits:3"]], ["We counted 12500 deaf voters.", ["grouping:plain:12500"]], ["The fund paid $12500cafe to members.", ["grouping:plain:12500"]], + ["The php7.4-fpm workers were busy.", []], + ["- 17:59 4 pages are sent to the team.", []], + ["- 17:59 The team gets 4 pages.", ["count-small:digits:4"]], ]; cases.forEach(([sentence, marks]) => { it(`${sentence} → ${marks.join(", ") || "none"}`, () => From a8c8908ac59574fd124f13dc380992c2c92e459a Mon Sep 17 00:00:00 2001 From: isamu Date: Mon, 30 Nov 2026 09:55:30 +0900 Subject: [PATCH 2/2] fix: number-style-consistency reads units of data and short time as measures Co-Authored-By: Claude Opus 5.5 --- text/packages/lang-en/lexicons/figure-noun.yaml | 14 ++++++++++++++ text/test/test_number_style.ts | 1 + 2 files changed, 15 insertions(+) diff --git a/text/packages/lang-en/lexicons/figure-noun.yaml b/text/packages/lang-en/lexicons/figure-noun.yaml index f426d825e..93e5b7863 100644 --- a/text/packages/lang-en/lexicons/figure-noun.yaml +++ b/text/packages/lang-en/lexicons/figure-noun.yaml @@ -30,3 +30,17 @@ entries: - pattern: degrees - pattern: percent - pattern: points + # Units of data and of short time, which specifications write in figures (4 bits, 2 bytes, 4 microseconds). + - pattern: milliseconds + - pattern: microseconds + - pattern: nanoseconds + - pattern: bits + - pattern: bytes + - pattern: octets + - pattern: kilobytes + - pattern: megabytes + - pattern: gigabytes + - pattern: terabytes + - pattern: kilobits + - pattern: megabits + - pattern: gigabits diff --git a/text/test/test_number_style.ts b/text/test/test_number_style.ts index 822d86bec..45a410dfb 100644 --- a/text/test/test_number_style.ts +++ b/text/test/test_number_style.ts @@ -139,6 +139,7 @@ describe("numberMarksIn: English", () => { ["The php7.4-fpm workers were busy.", []], ["- 17:59 4 pages are sent to the team.", []], ["- 17:59 The team gets 4 pages.", ["count-small:digits:4"]], + ["The field is 4 bits wide and takes 2 bytes at 2 megabits a second.", []], ]; cases.forEach(([sentence, marks]) => { it(`${sentence} → ${marks.join(", ") || "none"}`, () =>