Paranoid text spacing in Ruby
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin Port Pangu to Ruby May 3, 2015
lib Bump version for initial release May 4, 2015
spec Add Coveralls May 4, 2015
.gitignore Port Pangu to Ruby May 3, 2015
.travis.yml Add Travis CI config May 3, 2015
CHANGELOG.md Bump version for initial release May 4, 2015
CODE_OF_CONDUCT.md Port Pangu to Ruby May 3, 2015
Gemfile Add Coveralls May 4, 2015
LICENSE.txt Port Pangu to Ruby May 3, 2015
README.md Update README May 4, 2015
Rakefile Port Pangu to Ruby May 3, 2015
pangu.gemspec Update metadata May 3, 2015

README.md

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.