• Townie
    AI
  • Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
dpip

dpip

graphemeCounter

Public
Like
3
graphemeCounter
Home
Code
6
backend
1
frontend
3
shared
.vtignore
README.md
deno.json
Branches
1
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
Code
/
Search
index.ts
https://dpip--a09f5a68555111f0baeaf69ea79377d9.web.val.run
README.md

Grapheme Counter

A simple React web application that accurately counts graphemes in text, including emojis and complex characters.

Features

  • Real-time grapheme counting using Intl.Segmenter for accurate results
  • Multiple text statistics: graphemes, characters, and words
  • Example texts to demonstrate complex grapheme counting
  • Modern UI with TailwindCSS styling
  • Responsive design that works on all devices

What are Graphemes?

Graphemes are the smallest units of a writing system. They can be:

  • Single characters (like "a", "b", "c")
  • Emojis (like "🦕", "🌋")
  • Combining characters (like "é" which can be "e" + "́")
  • Complex sequences (like "👨‍👩‍👧‍👦" which is a family emoji)

For example, "dinosaurs 🦕 🌋🌴☄️" contains 14 graphemes: "d", "i", "n", "o", "s", "a", "u", "r", "s", " ", "🦕", "🌋", "🌴", "☄️".

Technical Details

  • Frontend: React 18.2.0 with TypeScript
  • Backend: Hono server for serving the app
  • Styling: TailwindCSS
  • Grapheme Counting: Uses Intl.Segmenter with granularity: 'grapheme'
  • Platform: Built for Val Town

Project Structure

├── backend/
│   └── index.ts              # Hono server entry point
├── frontend/
│   ├── components/
│   │   └── App.tsx           # Main React component with all logic
│   ├── index.html            # HTML template
│   └── index.tsx             # React entry point
└── README.md

Usage

  1. Enter text in the textarea
  2. View real-time statistics:
    • Graphemes: The number of visual units
    • Characters: The total character count
    • Words: The number of words
  3. Try the example texts to see complex grapheme counting in action

Example Results

TextGraphemesCharactersWords
"dinosaurs 🦕 🌋🌴☄️"14202
"Hello World! 👋"13152
"café 🍵"682
"👨‍👩‍👧‍👦"171

Browser Compatibility

The app uses Intl.Segmenter which is supported in:

  • Chrome 87+
  • Firefox 102+
  • Safari 15+
  • Edge 87+

For older browsers, it falls back to character counting.

Development

This is a Val Town project. The main entry point is backend/index.ts which serves the React application.

To run locally with Deno:

deno run --allow-net --allow-read backend/index.ts
HTTP
  • index.ts
    dpip--a09f5a68555111f0baeaf69ea79377d9.web.val.run
Code
backendfrontendshared.vtignoreREADME.mddeno.json
FeaturesVersion controlCode intelligenceCLI
Use cases
TeamsAI agentsSlackGTM
ExploreDocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.