Skip to content

Blog: Support readtime computation for Chinese, Japanese and Korean #8161

Closed
@PumpkinJui

Description

@PumpkinJui

Context

Because I'm Chinese, I write blog posts in Chinese with the blog plugin.
(For the same reason, forgive me if the grammar is awful.)

Bug description

Recently I wrote a film review, in which there are 8402 Chinese characters (according to my editor's counter). However, the generated readtime was 5 minutes.
A little math and I discovered that the generator thought it appropriate to read 1680 characters per minute. That was far from the documentation (which said 265).

I surfed the net and found Chinese Curriculum Standards for Compulsory Education. In page 21, it suggests 500 characters per min. So to set a reasonable post_readtime_words_per_minute, I write a sample file that contains only 1000 “啊” and the necessary parts to build, and start testing.
But only after I set the config to 1 did I get a 2-min readtime. That's ridiculous.

I re-checked the counter and found another entry called “word count”, which was 1263 for the review, and 6 for the test file. It seemed to count words with spaces as the separator.
That explained everything. If Material for MkDocs used the same way to compute the readtime, 1263/265 was between 4 and 5, and 1000 “啊” were just 1 word.

Conclusion:

  • Expected: The readtime is computed correctly for blogs written in Chinese.
  • Actually: The readtime is inaccurate and sometimes ridiculous, probably due to the incompatible character counting method.
  • Fix: Optimize the character counting method of readtime for Chinese, and probably Japanese, Korean, etc.

Related links

Reproduction

9.6.11-inaccurate-readtime-for-chinese-blogs.zip

I included the two blog posts mentioned before without modification: the film review and the 1000 “啊” sample file.

Due to the minimality, the first one may have broken parts in typesetting, but that has nothing to do with the readtime, I suppose.

Steps to reproduce

  1. Run mkdocs serve.
  2. Goto http://localhost:8000/blog/ and check the readtime.
  3. Un-comment post_readtime_words_per_minute in mkdocs.yml, change its value to any value you like, and check the readtime again.

Browser

No response

Before submitting

Metadata

Metadata

Assignees

No one assigned

    Labels

    change requestIssue requests a new feature or improvement

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions