Skip to content

Commit 8efe94c

Browse files
author
James Addison
committedOct 14, 2021
Require a word boundary after short tokens that can be interpreted as numbers
1 parent 6c6d650 commit 8efe94c

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed
 

Diff for: ‎src/locales/de/constants.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export const TIME_UNIT_DICTIONARY: { [word: string]: OpUnitType } = {
108108

109109
export const NUMBER_PATTERN = `(?:${matchAnyPattern(
110110
INTEGER_WORD_DICTIONARY
111-
)}|[0-9]+|[0-9]+\\.[0-9]+|half(?:\\s*an?)?|an?(?:\\s*few)?|few|several|a?\\s*couple\\s*(?:of)?)`;
111+
)}|[0-9]+|[0-9]+\\.[0-9]+|half(?:\\s*an?)?|an?\\b(?:\\s*few)?|few|several|a?\\s*couple\\s*(?:of)?)`;
112112

113113
export function parseNumberPattern(match: string): number {
114114
const num = match.toLowerCase();

Diff for: ‎src/locales/en/constants.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ export const TIME_UNIT_DICTIONARY: { [word: string]: OpUnitType } = {
162162

163163
export const NUMBER_PATTERN = `(?:${matchAnyPattern(
164164
INTEGER_WORD_DICTIONARY
165-
)}|[0-9]+|[0-9]+\\.[0-9]+|half(?:\\s{0,2}an?)?|an?(?:\\s{0,2}few)?|few|several|a?\\s{0,2}couple\\s{0,2}(?:of)?)`;
165+
)}|[0-9]+|[0-9]+\\.[0-9]+|half(?:\\s{0,2}an?)?|an?\\b(?:\\s{0,2}few)?|few|several|a?\\s{0,2}couple\\s{0,2}(?:of)?)`;
166166

167167
export function parseNumberPattern(match: string): number {
168168
const num = match.toLowerCase();

Diff for: ‎src/locales/fr/constants.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export const TIME_UNIT_DICTIONARY: { [word: string]: OpUnitType | QUnitType } =
105105

106106
export const NUMBER_PATTERN = `(?:${matchAnyPattern(
107107
INTEGER_WORD_DICTIONARY
108-
)}|[0-9]+|[0-9]+\\.[0-9]+|une?|quelques?|demi-?)`;
108+
)}|[0-9]+|[0-9]+\\.[0-9]+|une?\\b|quelques?|demi-?)`;
109109

110110
export function parseNumberPattern(match: string): number {
111111
const num = match.toLowerCase();

0 commit comments

Comments
 (0)