This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Partial implementation from https://zhuanlan.zhihu.com/p/33612593 */ | |
import _ from 'lodash'; | |
/* 标点 */ | |
const punctuationRegex = /\p{Punctuation}/u; | |
/* 空格 */ | |
const spaceRegex = /\p{Separator}/u; | |
/* CJK 字符,中日韩 */ | |
const cjkRegex = /\p{Script=Han}|\p{Script=Katakana}|\p{Script=Hiragana}|\p{Script=Hangul}/u; |