中英文混合,词数如何统计? ::-- ZoomQuiet [2007-05-08 02:39:44]
Contents
1. batfree.混合字串统计
Toggle line numbers
1 import re
2 cjkReg = re.compile(u'[\u1100-\uFFFDh]+?')
3 trimedCJK = cjkReg.sub( ' a ', inputString, 0)# replace the CJK with the word a
4 return len(trimedCJK.split())
- 做过一部分测试,与Word里面的字数统计数目一样,不过不知道是不是还有问题。