Online Historical Text Analyzer
Analyze word frequency, readability, and sentiment of historical texts.
Analysis Results
Your analysis results will appear here.
Comparison Results
Your comparison results will appear here.
How to Use the Analyzer
This tool provides several metrics to help you understand historical texts.
- Analyze Text Tab: Paste any text into the input box and click "Analyze". The tool will calculate general statistics, readability scores, word frequency, and sentiment.
- Compare Texts Tab: Paste two different texts into the provided boxes and click "Compare Texts". The tool will show a side-by-side comparison of their key statistics and vocabulary similarity.
- Load Sample Text: Use this button to load a pre-written text (an excerpt from the Declaration of Independence) to see how the tool works.
- Download as PDF: After running an analysis or comparison, a button will appear allowing you to download a professionally formatted PDF of the results.
Understanding the Metrics
- Readability Score (Flesch Reading Ease): A score from 0-100. Higher scores indicate easier to read text. Text with a score of 60-70 is considered plain English.
- Word Frequency: A list of the most common words in the text, excluding common "stop words" (like 'the', 'a', 'is'). This helps identify key themes and subjects.
- Sentiment Analysis: A basic measure of the text's emotional tone (Positive, Negative, or Neutral) based on the words used.
- Vocabulary Similarity (Jaccard Index): In the comparison tab, this measures the overlap in vocabulary between two texts. A score of 1 means identical vocabularies; 0 means no shared words.
${analysis.error}
`; downloadPdfBtn.classList.add('hidden'); return; } // Generate HTML for results const resultsHTML = `General Statistics
- Word Count: ${analysis.wordCount}
- Sentence Count: ${analysis.sentenceCount}
- Avg. Words per Sentence: ${analysis.averageWordsPerSentence}
Readability
- Flesch Reading Ease: ${analysis.fleschScore} (Higher is easier)
Sentiment Analysis
- Overall Tone: ${analysis.sentiment.label}
- Positive Words Found: ${analysis.sentiment.positiveWords}
- Negative Words Found: ${analysis.sentiment.negativeWords}
Top 15 Most Frequent Words
| Word | Count |
|---|---|
| ${item[0]} | ${item[1]} |
${analysis1.error || ''} ${analysis2.error || ''}
`; downloadComparisonPdfBtn.classList.add('hidden'); return; } // Jaccard similarity const set1 = new Set(text1.toLowerCase().match(/\b[\w']+\b/g)); const set2 = new Set(text2.toLowerCase().match(/\b[\w']+\b/g)); const intersection = new Set([...set1].filter(x => set2.has(x))); const union = new Set([...set1, ...set2]); const jaccardIndex = (intersection.size / union.size).toFixed(3); const comparisonHTML = `Vocabulary Similarity
Jaccard Index: ${jaccardIndex}
Measures vocabulary overlap. 1 is identical, 0 is no overlap.
Text 1 Analysis
- Word Count: ${analysis1.wordCount}
- Sentence Count: ${analysis1.sentenceCount}
- Flesch Score: ${analysis1.fleschScore}
- Sentiment: ${analysis1.sentiment.label}
Text 2 Analysis
- Word Count: ${analysis2.wordCount}
- Sentence Count: ${analysis2.sentenceCount}
- Flesch Score: ${analysis2.fleschScore}
- Sentiment: ${analysis2.sentiment.label}
