pangu.js

Opinionated paranoid text spacing in JavaScript, with on-device AI semantic judgment

What is pangu.js?

Opinionated paranoid text spacing in JavaScript, with on-device AI semantic judgment

Overview of pangu.js

What it is

pangu.js is an opinionated JavaScript library that automatically inserts whitespace between CJK (Chinese, Japanese, Korean) characters and ANS (alphabetical letters, numerical digits, and symbols) in text. It is part of a family of libraries and tools that implement the same spacing logic across multiple programming languages. The project also provides a Google Chrome extension that spaces every page you browse, and includes an on-device AI semantic judgment feature called AI Spacing.

Key features

  • Automatically inserts whitespace between CJK and ANS characters in text
  • Provides a JavaScript library for Node.js and browser environments
  • Includes a command-line interface (CLI) for spacing text from the terminal
  • Chrome extension with AI Spacing that uses Chrome's built-in Prompt API (Gemini Nano) to handle semantic nuances that regex cannot distinguish
  • AI Spacing runs fully offline on the user's device
  • Supports DOM manipulation methods like spaceNode() and autoSpacePage() for web pages

Use cases

  • Automatically spacing mixed-language content on web pages via the Chrome extension
  • Spacing text in Node.js applications or scripts
  • Spacing text files or piped input from the command line
  • Integrating text spacing into web applications using the browser build

Getting started

bashnpm install pangu --save-exactFor browser usage, import from pangu/browser:jsimport pangu from 'pangu/browser';For Node.js:jsimport pangu from 'pangu';For CLI usage, run pangu with text or file arguments.

License and pricing

Released under the MIT License. The project is open source and free.

Based on the project's public README and repository metadata.

Add this badge to your README

Featured on YunoDB Badge styles & help

Maintain this project? Show that it is featured on YunoDB.

Markdown[![Featured on YunoDB](https://yunodb.com/badge/vintapangujs.svg)](https://yunodb.com/tools/vintapangujs?utm_source=github&utm_medium=badge)
HTML<a href="https://yunodb.com/tools/vintapangujs?utm_source=github&utm_medium=badge"><img src="https://yunodb.com/badge/vintapangujs.svg" alt="Featured on YunoDB" height="20"></a>