๐Ÿ“ฆ vinta / pangu

Paranoid text spacing in Go (Golang)

โ˜… 112 stars โ‘‚ 13 forks ๐Ÿ‘ 112 watching โš–๏ธ MIT License
๐Ÿ“ฅ Clone https://github.com/vinta/pangu.git
HTTPS git clone https://github.com/vinta/pangu.git
SSH git clone git@github.com:vinta/pangu.git
CLI gh repo clone vinta/pangu
Vinta Chen Vinta Chen Update README.md 03308b8 2 years ago ๐Ÿ“ History
๐Ÿ“‚ master View all commits โ†’
๐Ÿ“ _fixtures
๐Ÿ“ pangu-axe
๐Ÿ“„ .gitignore
๐Ÿ“„ .travis.yml
๐Ÿ“„ benchmark_test.go
๐Ÿ“„ CHANGELOG.md
๐Ÿ“„ doc.go
๐Ÿ“„ example_test.go
๐Ÿ“„ LICENSE
๐Ÿ“„ pangu_test.go
๐Ÿ“„ pangu.go
๐Ÿ“„ README.md
๐Ÿ“„ README.md

pangu.go ========

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).

Installation

To install the package, pangu, for using in your Go programs:

$ go get -u github.com/vinta/pangu

To install the command-line tool, pangu-axe:

$ go get -u github.com/vinta/pangu/pangu-axe

Usage

Package

package main

import (
    "fmt"
    "github.com/vinta/pangu"
)

func main() {
    s := pangu.SpacingText("็•ถไฝ ๅ‡่ฆ–่‘—bug๏ผŒbugไนŸๅ‡่ฆ–่‘—ไฝ ")
    fmt.Println(s)
    // Output:
    // ็•ถไฝ ๅ‡่ฆ–่‘— bug๏ผŒbug ไนŸๅ‡่ฆ–่‘—ไฝ 
}

Command-line Interface

$ pangu-axe text "่ˆ‡PMๆˆฐ้ฌฅ็š„ไบบ๏ผŒๆ‡‰็•ถๅฐๅฟƒ่‡ชๅทฑไธ่ฆๆˆ็‚บPM"
่ˆ‡ PM ๆˆฐ้ฌฅ็š„ไบบ๏ผŒๆ‡‰็•ถๅฐๅฟƒ่‡ชๅทฑไธ่ฆๆˆ็‚บ PM

$ pangu-axe file ้Š€ๆฒณไพฟ่ปŠๆŒ‡ๅ—.txt
$ pangu-axe file ๅฎ‡ๅฎ™็›ก้ ญ็š„้คๅปณ.txt -o ๅฎ‡ๅฎ™็›ก้ ญ็š„้คๅปณ๏ผˆๅฅฝ่ฎ€็‰ˆ๏ผ‰.txt
$ pangu-axe file ็”Ÿๅ‘ฝใ€ๅฎ‡ๅฎ™ๅŠ่ฌไบ‹่ฌ็‰ฉ.txt ๅ†่ฆ‹๏ผŒ่ฌ่ฌไฝ ็š„้ญš.txt ๅŸบๆœฌ็„กๅฎณ.txt

Documentation

Have a question? Ask it on the GitHub issues!