Phonetik
Phonetic analysis engine that gives LLMs accurate rhyme detection, stress scanning, meter identification, and syllable counting backed by the full CMU Pronouncing Dictionary.
README
phonetik
A Rust library and HTTP server for English phonetic analysis. Rhyme detection, stress scanning, meter identification, and syllable counting — backed by the full CMU Pronouncing Dictionary compiled directly into the binary.
No files to download. No API keys. No runtime dependencies. Phonetik::new() and go.
What it does
- Rhyme finding — perfect, slant, and near rhymes with confidence scores
- Stress analysis — extract stress patterns from any English text
- Meter detection — identify iambic pentameter, trochaic tetrameter, etc.
- Phoneme lookup — ARPAbet transcriptions for 126K words
- Syllable counting — per-word and batch
- Rhyme map — detect phoneme repetition patterns across lines of verse
- Word comparison — phonetic similarity scoring between any two words
Install
[dependencies]
phonetik = "0.3"
Or install the binaries:
cargo install phonetik
This gives you phonetik-server (HTTP API) and phonetik-mcp (MCP tool server).
Usage
use phonetik::Phonetik;
let ph = Phonetik::new();
// Rhymes
for r in ph.rhymes("love", 10) {
println!("{} ({:?}, {:.0}%)", r.word, r.rhyme_type, r.confidence * 100.0);
}
// ABOVE (Perfect, 100%)
// DOVE (Perfect, 100%)
// GLOVE (Perfect, 100%)
// MOVE (Slant, 60%)
// GROOVE (Slant, 60%)
// Meter
let scan = ph.scan("uneasy lies the head that wears the crown");
println!("{} — {}", scan.visual, scan.meter.name);
// x / x / x / x / x / — iambic pentameter
// Comparison
let cmp = ph.compare("cat", "bat").unwrap();
println!("{:.0}% similar, {:?}", cmp.similarity * 100.0, cmp.rhyme_type);
// 67% similar, Perfect
// Lookup
let info = ph.lookup("extraordinary").unwrap();
println!("{}: {} syllables", info.word, info.syllable_count);
// EXTRAORDINARY: 6 syllables
How it works
The entire CMU Pronouncing Dictionary is compiled into the binary at build time. Every phoneme is encoded as a single byte — no strings in the hot path. Rhyme detection is algorithmic:
- Perfect rhymes are resolved by grouping words that share identical sound from their last stressed vowel onward. One hash lookup.
- Slant rhymes use a vowel distance matrix and coda suffix matching. Words sharing the same consonant ending but different vowels (love/move) are found by index traversal, not pairwise comparison.
- Near rhymes walk a precomputed graph of consonant clusters that differ by one edit. Same vowel, slightly different ending (night/nice).
Server
The crate includes an HTTP server binary behind the server feature (enabled by default):
cargo install phonetik
phonetik-server
# Phonetik starting on :1273 [126052 words]
Endpoints: /health, /syllables, /syllable-counts, /rhymes, /rhymes/perfect, /rhymes/slant, /rhymes/near, /compare, /scan, /rhymemap, /document
MCP
phonetik includes an MCP (Model Context Protocol) server so AI assistants can use it as a tool. Runs over stdio — no network, no auth.
cargo install phonetik
Add to your MCP client config (Claude Code, Cursor, etc.):
{
"phonetik": {
"command": "phonetik-mcp"
}
}
Tools: lookup, rhymes, scan, compare, analyze_document
Feature flags
Both server and mcp are enabled by default. For library-only use:
[dependencies]
phonetik = { version = "0.3", default-features = false }
License
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.