| name | grammarly-data-handling |
| description | Implement Grammarly data handling patterns for document processing.
Use when handling large documents, managing text chunking,
or implementing data pipelines for Grammarly API.
Trigger with phrases like "grammarly data", "grammarly documents",
"grammarly text processing", "grammarly pipeline".
|
| allowed-tools | Read, Write, Edit |
| version | 1.8.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","grammarly","writing"] |
| compatibility | Designed for Claude Code |
Grammarly Data Handling
Overview
Handle large documents, text chunking, and data pipelines for Grammarly API. The API accepts max 100,000 characters (4 MB) with a minimum of 30 words.
Instructions
Step 1: Text Chunking
function chunkText(text: string, maxChars = 90000): string[] {
if (text.length <= maxChars) return [text];
const paragraphs = text.split('\n\n');
const chunks: string[] = [];
let current = '';
for (const p of paragraphs) {
if ((current + '\n\n' + p).length > maxChars && current) {
chunks.push(current);
current = p;
} else {
current = current ? current + '\n\n' + p : p;
}
}
if (current) chunks.push(current);
return chunks;
}
Step 2: Aggregate Scores Across Chunks
function aggregateScores(scores: any[]): any {
const avg = (arr: number[]) => arr.reduce((a, b) => a + b, ) / arr.;
{
: .((scores.( s.))),
: .((scores.( s.))),
: .((scores.( s.))),
: .((scores.( s.))),
: .((scores.( s.))),
: scores.,
};
}