Skip to content
Paranoid text spacing as a service
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs add a simple static site Apr 10, 2018
fixtures add functions Apr 10, 2018
infrastructure manage AWS infrastructures with Terraform Apr 15, 2018
Gopkg.toml use dep for Go dependency management Apr 10, 2018
Makefile improve Makefile Apr 10, 2018
mkdocs.yml add a simple static site Apr 10, 2018
project.json add functions Apr 10, 2018

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


Current APIs:


in Command-line interface:

$ curl -G --data-urlencode "t=當你凝視著bug,bug也凝視著你" -H "x-api-key: TiEeVInyGza4ta0kougRH4MBBfdGe2Q91TjrbQLm" -w "\n"
當你凝視著 bug,bug 也凝視著你

in Python:

import requests

r = requests.get('當你凝視著bug,bug也凝視著你', headers={'x-api-key': 'TiEeVInyGza4ta0kougRH4MBBfdGe2Q91TjrbQLm'})
# 當你凝視著 bug,bug 也凝視著你

You must request the API with a HTTP header x-api-key: TiEeVInyGza4ta0kougRH4MBBfdGe2Q91TjrbQLm. Yeah, you are free to use the API key for accessing the service. Although it has a quota of 100000 requests per month.

Development is built on AWS Lambda and Amazon API Gateway. I use Apex to manage and deploy Lambda functions.

# deploy all functions
$ apex deploy

# view logs
$ apex logs -f

# invoke a function directly
$ apex invoke spacing_text --logs
    "statusCode": 400,
    "headers": null,
    "body":"{\"message\": \"No text was provided in HTTP query string\"}"

# invoke a function with an API Gateway event
$ cat fixtures/spacing_text_event.json
    "queryStringParameters": {"t": "與PM戰鬥的人,應當小心自己不要成為PM"}
$ apex invoke spacing_text --logs < fixtures/spacing_text_event.json
    "statusCode": 200,
    "headers": {"content-type": "text/plain; charset=utf-8"},
    "body": "與 PM 戰鬥的人,應當小心自己不要成為 PM"

Related Posts

You can’t perform that action at this time.