Skip to content

Commit

Permalink
Require a word boundary after short tokens that can be interpreted as…
Browse files Browse the repository at this point in the history
… numbers
  • Loading branch information
James Addison committed Oct 14, 2021
1 parent 6c6d650 commit 8efe94c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/locales/de/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export const TIME_UNIT_DICTIONARY: { [word: string]: OpUnitType } = {

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

export function parseNumberPattern(match: string): number {
const num = match.toLowerCase();
Expand Down
2 changes: 1 addition & 1 deletion src/locales/en/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export const TIME_UNIT_DICTIONARY: { [word: string]: OpUnitType } = {

export const NUMBER_PATTERN = `(?:${matchAnyPattern(
INTEGER_WORD_DICTIONARY
)}|[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)?)`;
)}|[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)?)`;

export function parseNumberPattern(match: string): number {
const num = match.toLowerCase();
Expand Down
2 changes: 1 addition & 1 deletion src/locales/fr/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export const TIME_UNIT_DICTIONARY: { [word: string]: OpUnitType | QUnitType } =

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

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

0 comments on commit 8efe94c

Please sign in to comment.