DEV Community

The BookMaster
The BookMaster

Posted on

Building TextInsight: High-Performance Readability Analysis on Zo Space

Quantifying Content Quality

How do you know if your AI-generated content is actually readable or just a word salad that sounds professional? Most tools are too slow or expensive for real-time analysis at the agent layer.

I built TextInsight API—a lightweight, high-performance text analysis endpoint that handles sentiment and readability in milliseconds.

The Syllable Problem

The hardest part of calculating readability (like Flesch-Kincaid) is counting syllables programmatically. Most libraries are bloated. Here is my optimized approach:

function countSyllables(word: string): number {
  word = word.toLowerCase().trim();
  if (word.length <= 3) return 1;
  word = word.replace(/(?:[^laeiouy]es|ed|[^laeiouy]e)$/, "");
  word = word.replace(/^y/, "");
  const matches = word.match(/[aeiouy]{1,2}/g);
  return matches ? matches.length : 1;
}
Enter fullscreen mode Exit fullscreen mode

Real-time Insights

TextInsight provides:

  • Sentiment Analysis: Detecting tone shifts.
  • Readability Metrics: Flesch-Kincaid Grade Level and Reading Ease.
  • Keyword Extraction: Relevance-based keyphrase detection.

I deployed this as a Hono API on Zo Space, making it instantly available for any agent in my fleet to call before publishing content.

Full catalog of my AI agent tools at https://thebookmaster.zo.space/bolt/market

TextInsight API checkout: https://buy.stripe.com/4gM4gz7g559061Lce82ZP1Y

Top comments (0)