vinta/pangu.js

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

View on GitHub ↗Jump to charts ↓Open shareable report

Summary Information

Updated 53 minutes ago
Added to GitGenius on September 14th, 2026
Created on February 21st, 2012
Open Issues & Pull Requests: 3 (+0)
GitHub issues: Enabled
Number of forks: 314
Total Stargazers: 4,819 (+0)
Total Subscribers: 65 (+0)

Repository Insights (GitGenius)

Median issue/PR response: 39.5 days
Mean response time: 536.7 days
90th percentile: 2050.5 days
Tracked items: 71

Most active contributors

Sign in to see contributor activity.

How this project is maintained

Around half of the issues opened in the past year never receive a reply. Only 18% of issues opened in the past year have been closed. Three people close 97% of everything that gets resolved.

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Open issues: 1
New in 7 days: 0
Closed in 7 days: 3
Avg open age: 2,782 days
Stale 30+ days: 1
Stale 90+ days: 0

Recent activity

Opened in 7 days: 0
Closed in 7 days: 3
Comments in 7 days: 0
Events in 7 days: 0

Top labels

  • ready-for-agent (10)
  • help wanted (5)
  • not-proper-spacing (3)
  • wontfix (1)

Detailed Description

pangu.js is a text spacing tool that automatically inserts spaces between Chinese characters and English letters, numbers, and symbols in JavaScript environments.

The tool solves the problem of mixed-script text appearing cramped and difficult to read. It works by applying spacing rules between full-width Chinese characters and half-width Latin characters, numbers, and punctuation. The core library uses regex-based pattern matching for standard cases. The Chrome extension builds on this with an AI Spacing feature that handles ambiguous symbols where context matters. For example, the plus sign in "18+" should not be spaced (meaning "or more"), but in "2 + Mario Kart" it should be spaced (as an operator). Rather than relying on fixed rules, the extension uses Chrome's Prompt API to run Gemini Nano locally on the device, allowing semantic judgment without sending data to external servers.

Developers should choose this tool if they need to automatically format mixed Chinese-English text in web applications or browser extensions. The library is available as an npm package for JavaScript projects. The Chrome extension is the most accessible form for end users who want automatic spacing across all web pages they visit. The project also maintains implementations in multiple programming languages, so developers working in Python, Go, Java, and other languages have equivalent options available.

Development activity shows a methodical approach to prompt engineering. The project uses an AI agent to propose and test spacing rules against the actual Gemini Nano model running in Chrome, rather than guessing at prompts. When test cases fail, the agent interviews the model to understand why and searches for alternative approaches. This iterative refinement cycle means the prompts are validated against real model behavior rather than theoretical assumptions.