Online Redundant Phrase Detector
Improve clarity and conciseness in your writing.
Paste Your Text Below
Analysis Results
Analyzing your text...
Highlighted Text
Suggestions for Conciseness
No redundant phrases found. Great job!
'; } else { results.forEach(item => { const regex = new RegExp(item.phrase.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'), 'gi'); highlightedHtml = highlightedHtml.replace(regex, `${item.phrase}`); suggestionsHtml += `
${item.phrase}
→
${item.suggestion}
`;
});
}
highlightedTextEl.innerHTML = highlightedHtml;
suggestionsListEl.innerHTML = suggestionsHtml;
};
const handleDownloadPdf = () => {
if (!window.jspdf || !analysisResults) {
console.error('jsPDF not loaded or no analysis data available.');
return;
}
const { jsPDF } = window.jspdf;
const pdf = new jsPDF({ orientation: 'portrait', unit: 'pt', format: 'a4' });
const pageW = pdf.internal.pageSize.getWidth();
const margin = 50;
let cursorY = 0;
// --- PDF Template: Writing Conciseness Report ---
pdf.setFillColor(247, 250, 252); // Gray 100
pdf.rect(0, 0, pageW, 70, 'F');
pdf.setFont('helvetica', 'bold').setFontSize(20).setTextColor(45, 55, 72); // Gray 800
pdf.text('Writing Conciseness Report', margin, 45);
cursorY = 110;
// Original Text
pdf.setFont('helvetica', 'bold').setFontSize(11).setTextColor(42, 108, 176); // Blue 700
pdf.text('ORIGINAL TEXT', margin, cursorY);
cursorY += 20;
const originalLines = pdf.setFont('helvetica', 'normal').setFontSize(10).setTextColor(74, 85, 104)
.splitTextToSize(originalTextEl.value || 'N/A', pageW - margin * 2);
pdf.text(originalLines, margin, cursorY);
cursorY += (originalLines.length * 10) + 25;
pdf.setDrawColor(226, 232, 240).line(margin, cursorY - 10, pageW - margin, cursorY - 10);
cursorY += 10;
// Suggestions
pdf.setFont('helvetica', 'bold').setFontSize(11).setTextColor(42, 108, 176); // Blue 700
pdf.text('SUGGESTIONS', margin, cursorY);
cursorY += 25;
if (analysisResults.length > 0) {
pdf.setFont('helvetica', 'bold').setFontSize(10);
pdf.setTextColor(45, 55, 72);
pdf.text("Redundant Phrase", margin, cursorY);
pdf.text("Suggestion", margin + 200, cursorY);
cursorY += 5;
pdf.setDrawColor(226, 232, 240).line(margin, cursorY, pageW - margin, cursorY);
cursorY += 15;
pdf.setFont('helvetica', 'normal').setFontSize(10);
analysisResults.forEach(item => {
if (cursorY > pdf.internal.pageSize.getHeight() - margin) {
pdf.addPage();
cursorY = margin;
}
pdf.setTextColor(197, 48, 48); // Red
pdf.text(item.phrase, margin, cursorY);
pdf.setTextColor(47, 133, 90); // Green
pdf.text(item.suggestion, margin + 200, cursorY);
cursorY += 20;
});
} else {
pdf.setFont('helvetica', 'italic').setFontSize(10).setTextColor(74, 85, 104);
pdf.text("No redundant phrases were detected in the text.", margin, cursorY);
}
pdf.save(`Conciseness-Report.pdf`);
};
// --- Event Listeners ---
if (downloadPdfBtn) downloadPdfBtn.addEventListener('click', handleDownloadPdf);
});
