Skip to content

Commit

Permalink
Word count: Adjust to count numbers as words (#27288)
Browse files Browse the repository at this point in the history
* Adjust to count numbers as words

* Put back the missing range
  • Loading branch information
phena109 authored May 14, 2021
1 parent be3f7ff commit 8331d12
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/wordcount/src/defaultSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const defaultSettings = {
'[',

// Basic Latin (extract)
'\u0021-\u0040\u005B-\u0060\u007B-\u007E',
'\u0021-\u002F\u003A-\u0040\u005B-\u0060\u007B-\u007E',

// Latin-1 Supplement (extract)
'\u0080-\u00BF\u00D7\u00F7',
Expand Down
9 changes: 8 additions & 1 deletion packages/wordcount/src/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,17 @@ describe( 'WordCounter', () => {
{
message: 'Punctuation.',
string: 'It’s two three \u2026 4?',
words: 3,
words: 4,
characters_excluding_spaces: 15,
characters_including_spaces: 19,
},
{
message: 'Numbers as word',
string: 'Should be 4 words',
words: 4,
characters_excluding_spaces: 14,
characters_including_spaces: 17,
},
{
message: 'Em dash.',
string: 'one\u2014two--three',
Expand Down

0 comments on commit 8331d12

Please sign in to comment.