From 7f8630b91c1ef0a650bfe7cf422126187eb3c8f2 Mon Sep 17 00:00:00 2001 From: lizyn Date: Sat, 5 Jan 2019 12:30:15 +0800 Subject: Counting two characters together as a word in CJK --- src/Wallabag/CoreBundle/Tools/Utils.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Wallabag/CoreBundle') diff --git a/src/Wallabag/CoreBundle/Tools/Utils.php b/src/Wallabag/CoreBundle/Tools/Utils.php index c14d2aa0..e56e251e 100644 --- a/src/Wallabag/CoreBundle/Tools/Utils.php +++ b/src/Wallabag/CoreBundle/Tools/Utils.php @@ -28,6 +28,6 @@ class Utils */ public static function getReadingTime($text) { - return floor(\count(preg_split('~([^\p{L}\p{N}\']+|\p{Han}|\p{Hiragana}|\p{Katakana}|\p{Hangul})~u', strip_tags($text))) / 200); + return floor(\count(preg_split('~([^\p{L}\p{N}\']+|(\p{Han}|\p{Hiragana}|\p{Katakana}|\p{Hangul}){1,2})~u', strip_tags($text))) / 200); } } -- cgit v1.2.3