• 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 intelligenceCLIMCP
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
Weโ€™re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
ยฉ 2025 Val Town, Inc.