pangu.rb icon indicating copy to clipboard operation
pangu.rb copied to clipboard

Paranoid text spacing in Ruby

pangu.rb

Build Status Coverage Status

Paranoid text spacing for good readability, to automatically insert whitespace between CJK (Chinese, Japanese, Korean), half-width English, digit and symbol characters.

Installation

gem install pangu

Usage

require "pangu"

Pangu.spacing("請問Jackie的鼻子有幾個?123個!")
=> "請問 Jackie 的鼻子有幾個?123 個!"
Pangu.spacing("主要成份:眼鏡95%、水3%、垃圾2%。")                                                                                                                                        
=> "主要成份:眼鏡 95%、水 3%、垃圾 2%。"
Pangu.spacing("新阿姆斯特朗炫風噴射阿姆斯特朗砲")
=> "新阿姆斯特朗炫風噴射阿姆斯特朗砲"

License

Copyright (c) 2015 Richard Lee. See LICENSE.txt for details.