Paranoid text spacing for good readability, to automatically insert whitespace between CJK (Chinese, Japanese, Korean) and half-width characters (alphabetical letters, numerical digits and symbols).
- pangu.go (Go)
- pangu.java (Java)
- pangu.js (JavaScript, both Node.js and Browser)
- pangu.objective-c (Objective-C)
- pangu.php (PHP)
- pangu.py (Python)
- pangu.rb (Ruby)
$ pip install pangu
import pangu
pangu.spacing('新八的構造成分有95%是眼鏡、3%是水、2%是垃圾')
# output: u'新八的構造成分有 95% 是眼鏡、3% 是水、2% 是垃圾'
pangu.spacing_text("Mr.龍島主道:「Let's Party!各位高明博雅君子!」")
# output: u"Mr. 龍島主道:「Let's Party! 各位高明博雅君子!」"
spacing_text()
is an alias of spacing()
.