Module calculates whitespaces instead of words

Created on 3 August 2021, over 3 years ago
Updated 8 November 2023, about 1 year ago

Problem/Motivation

After installation and configuring the module I faced that calculating read time goes wrong.
During debugging I found that we are calculating whitespaces instead of words by regular expression
\s+

To count words we should use another expression:
\w+

Steps to reproduce

Configure the module with words per minute value 120
Fill node body field with approximate 480 words

Expected read time value: 4 mins

Actual result: 3 mins

Word count: 355

Instead of: 477

Proposed resolution

I'm going to attach the patch here to fix the issue.

πŸ› Bug report
Status

Closed: cannot reproduce

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine ysamoylenko

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024