undefined - Initial Deployment
Browse files- README.md +7 -5
- index.html +517 -19
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: readability-analyzer
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: green
|
| 5 |
+
colorTo: red
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,517 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Readability Analyzer</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 9 |
+
<style>
|
| 10 |
+
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
|
| 11 |
+
|
| 12 |
+
body { font-family: 'Inter', sans-serif; }
|
| 13 |
+
|
| 14 |
+
.gradient-bg {
|
| 15 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
.text-gradient {
|
| 19 |
+
background: linear-gradient(135deg, #667eea, #764ba2);
|
| 20 |
+
-webkit-background-clip: text;
|
| 21 |
+
-webkit-text-fill-color: transparent;
|
| 22 |
+
background-clip: text;
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
.glass-effect {
|
| 26 |
+
background: rgba(255, 255, 255, 0.1);
|
| 27 |
+
backdrop-filter: blur(10px);
|
| 28 |
+
border: 1px solid rgba(255, 255, 255, 0.2);
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
.hover-scale {
|
| 32 |
+
transition: transform 0.3s ease;
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
.hover-scale:hover {
|
| 36 |
+
transform: translateY(-2px);
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
.fade-in {
|
| 40 |
+
animation: fadeIn 0.5s ease-in;
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
@keyframes fadeIn {
|
| 44 |
+
from { opacity: 0; transform: translateY(20px); }
|
| 45 |
+
to { opacity: 1; transform: translateY(0); }
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
.pulse-animation {
|
| 49 |
+
animation: pulse 2s infinite;
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
@keyframes pulse {
|
| 53 |
+
0%, 100% { opacity: 1; }
|
| 54 |
+
50% { opacity: 0.7; }
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
.score-ring {
|
| 58 |
+
transform: rotate(-90deg);
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
.score-ring circle {
|
| 62 |
+
transition: stroke-dashoffset 0.5s ease;
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
.char-count {
|
| 66 |
+
transition: all 0.3s ease;
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
.reading-level {
|
| 70 |
+
transition: all 0.3s ease;
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
.tooltip {
|
| 74 |
+
position: relative;
|
| 75 |
+
cursor: help;
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
.tooltip:hover .tooltip-text {
|
| 79 |
+
visibility: visible;
|
| 80 |
+
opacity: 1;
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
.tooltip-text {
|
| 84 |
+
visibility: hidden;
|
| 85 |
+
opacity: 0;
|
| 86 |
+
position: absolute;
|
| 87 |
+
bottom: 125%;
|
| 88 |
+
left: 50%;
|
| 89 |
+
transform: translateX(-50%);
|
| 90 |
+
background: rgba(0, 0, 0, 0.8);
|
| 91 |
+
color: white;
|
| 92 |
+
padding: 8px 12px;
|
| 93 |
+
border-radius: 6px;
|
| 94 |
+
font-size: 12px;
|
| 95 |
+
white-space: nowrap;
|
| 96 |
+
z-index: 10;
|
| 97 |
+
transition: opacity 0.3s;
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
.tooltip-text::after {
|
| 101 |
+
content: '';
|
| 102 |
+
position: absolute;
|
| 103 |
+
top: 100%;
|
| 104 |
+
left: 50%;
|
| 105 |
+
transform: translateX(-50%);
|
| 106 |
+
border: 5px solid transparent;
|
| 107 |
+
border-top-color: rgba(0, 0, 0, 0.8);
|
| 108 |
+
}
|
| 109 |
+
</style>
|
| 110 |
+
</head>
|
| 111 |
+
<body class="min-h-screen gradient-bg">
|
| 112 |
+
<div class="container mx-auto px-4 py-8">
|
| 113 |
+
<!-- Header -->
|
| 114 |
+
<header class="text-center mb-8">
|
| 115 |
+
<h1 class="text-4xl md:text-6xl font-bold text-white mb-4">
|
| 116 |
+
<i class="fas fa-brain mr-3"></i>
|
| 117 |
+
Readability Analyzer
|
| 118 |
+
</h1>
|
| 119 |
+
<p class="text-white/80 text-lg md:text-xl max-w-2xl mx-auto">
|
| 120 |
+
Analyze your text's readability with advanced metrics and get actionable insights
|
| 121 |
+
</p>
|
| 122 |
+
</header>
|
| 123 |
+
|
| 124 |
+
<!-- Main Content -->
|
| 125 |
+
<div class="max-w-6xl mx-auto">
|
| 126 |
+
<!-- Input Section -->
|
| 127 |
+
<div class="bg-white/10 backdrop-blur-lg rounded-2xl p-6 mb-8 border border-white/20">
|
| 128 |
+
<div class="flex items-center justify-between mb-4">
|
| 129 |
+
<h2 class="text-2xl font-semibold text-white">
|
| 130 |
+
<i class="fas fa-edit mr-2"></i>
|
| 131 |
+
Input Text
|
| 132 |
+
</h2>
|
| 133 |
+
<div class="flex items-center space-x-4">
|
| 134 |
+
<span class="text-white/70 text-sm">
|
| 135 |
+
<span id="wordCount" class="font-bold text-white">0</span> words
|
| 136 |
+
</span>
|
| 137 |
+
<span class="text-white/70 text-sm">
|
| 138 |
+
<span id="charCount" class="font-bold text-white">0</span> chars
|
| 139 |
+
</span>
|
| 140 |
+
</div>
|
| 141 |
+
</div>
|
| 142 |
+
|
| 143 |
+
<textarea
|
| 144 |
+
id="textInput"
|
| 145 |
+
class="w-full h-64 p-4 bg-white/10 border border-white/20 rounded-lg text-white placeholder-white/60 focus:outline-none focus:ring-2 focus:ring-white/50 resize-none"
|
| 146 |
+
placeholder="Paste or type your text here to analyze its readability..."
|
| 147 |
+
></textarea>
|
| 148 |
+
|
| 149 |
+
<div class="flex flex-wrap gap-4 mt-4">
|
| 150 |
+
<button id="analyzeBtn" class="px-6 py-3 bg-white/20 hover:bg-white/30 text-white rounded-lg font-medium transition-all hover:scale-105">
|
| 151 |
+
<i class="fas fa-chart-line mr-2"></i>
|
| 152 |
+
Analyze Text
|
| 153 |
+
</button>
|
| 154 |
+
<button id="clearBtn" class="px-6 py-3 bg-red-500/20 hover:bg-red-500/30 text-white rounded-lg font-medium transition-all hover:scale-105">
|
| 155 |
+
<i class="fas fa-trash mr-2"></i>
|
| 156 |
+
Clear
|
| 157 |
+
</button>
|
| 158 |
+
<button id="sampleBtn" class="px-6 py-3 bg-green-500/20 hover:bg-green-500/30 text-white rounded-lg font-medium transition-all hover:scale-105">
|
| 159 |
+
<i class="fas fa-file-alt mr-2"></i>
|
| 160 |
+
Load Sample
|
| 161 |
+
</button>
|
| 162 |
+
</div>
|
| 163 |
+
</div>
|
| 164 |
+
|
| 165 |
+
<!-- Results Section -->
|
| 166 |
+
<div id="resultsSection" class="hidden">
|
| 167 |
+
<!-- Overall Score -->
|
| 168 |
+
<div class="grid md:grid-cols-2 gap-8 mb-8">
|
| 169 |
+
<div class="bg-white/10 backdrop-blur-lg rounded-2xl p-6 border border-white/20">
|
| 170 |
+
<h3 class="text-xl font-semibold text-white mb-4">
|
| 171 |
+
<i class="fas fa-star mr-2"></i>
|
| 172 |
+
Overall Readability Score
|
| 173 |
+
</h3>
|
| 174 |
+
<div class="relative w-32 h-32 mx-auto">
|
| 175 |
+
<svg class="w-32 h-32 score-ring">
|
| 176 |
+
<circle
|
| 177 |
+
cx="64"
|
| 178 |
+
cy="64"
|
| 179 |
+
r="56"
|
| 180 |
+
stroke="rgba(255,255,255,0.2)"
|
| 181 |
+
stroke-width="8"
|
| 182 |
+
fill="none"
|
| 183 |
+
/>
|
| 184 |
+
<circle
|
| 185 |
+
id="scoreCircle"
|
| 186 |
+
cx="64"
|
| 187 |
+
cy="64"
|
| 188 |
+
r="56"
|
| 189 |
+
stroke="#10b981"
|
| 190 |
+
stroke-width="8"
|
| 191 |
+
fill="none"
|
| 192 |
+
stroke-dasharray="351.86"
|
| 193 |
+
stroke-dashoffset="351.86"
|
| 194 |
+
/>
|
| 195 |
+
</svg>
|
| 196 |
+
<div class="absolute inset-0 flex items-center justify-center">
|
| 197 |
+
<span id="overallScore" class="text-3xl font-bold text-white">0</span>
|
| 198 |
+
<span class="text-white/70 text-sm ml-1">/100</span>
|
| 199 |
+
</div>
|
| 200 |
+
</div>
|
| 201 |
+
<p id="scoreText" class="text-center text-white/80 mt-4">Analyzing...</p>
|
| 202 |
+
</div>
|
| 203 |
+
|
| 204 |
+
<div class="bg-white/10 backdrop-blur-lg rounded-2xl p-6 border border-white/20">
|
| 205 |
+
<h3 class="text-xl font-semibold text-white mb-4">
|
| 206 |
+
<i class="fas fa-graduation-cap mr-2"></i>
|
| 207 |
+
Reading Level
|
| 208 |
+
</h3>
|
| 209 |
+
<div class="text-center">
|
| 210 |
+
<div id="readingLevel" class="text-4xl font-bold text-white mb-2">--</div>
|
| 211 |
+
<div id="gradeLevel" class="text-white/80 mb-4">--</div>
|
| 212 |
+
<div id="readingTime" class="text-white/70">
|
| 213 |
+
<i class="fas fa-clock mr-2"></i>
|
| 214 |
+
~-- min read
|
| 215 |
+
</div>
|
| 216 |
+
</div>
|
| 217 |
+
</div>
|
| 218 |
+
</div>
|
| 219 |
+
|
| 220 |
+
<!-- Detailed Metrics -->
|
| 221 |
+
<div class="grid md:grid-cols-2 lg:grid-cols-3 gap-6 mb-8">
|
| 222 |
+
<div class="bg-white/10 backdrop-blur-lg rounded-xl p-4 border border-white/20 hover-scale">
|
| 223 |
+
<div class="flex items-center justify-between">
|
| 224 |
+
<div>
|
| 225 |
+
<h4 class="text-white font-medium">Flesch Score</h4>
|
| 226 |
+
<p class="text-white/60 text-sm">Higher is easier</p>
|
| 227 |
+
</div>
|
| 228 |
+
<div id="fleschScore" class="text-2xl font-bold text-green-400">--</div>
|
| 229 |
+
</div>
|
| 230 |
+
</div>
|
| 231 |
+
|
| 232 |
+
<div class="bg-white/10 backdrop-blur-lg rounded-xl p-4 border border-white/20 hover-scale">
|
| 233 |
+
<div class="flex items-center justify-between">
|
| 234 |
+
<div>
|
| 235 |
+
<h4 class="text-white font-medium">Gunning Fog</h4>
|
| 236 |
+
<p class="text-white/60 text-sm">Years of education</p>
|
| 237 |
+
</div>
|
| 238 |
+
<div id="gunningFog" class="text-2xl font-bold text-blue-400">--</div>
|
| 239 |
+
</div>
|
| 240 |
+
</div>
|
| 241 |
+
|
| 242 |
+
<div class="bg-white/10 backdrop-blur-lg rounded-xl p-4 border border-white/20 hover-scale">
|
| 243 |
+
<div class="flex items-center justify-between">
|
| 244 |
+
<div>
|
| 245 |
+
<h4 class="text-white font-medium">SMOG Index</h4>
|
| 246 |
+
<p class="text-white/60 text-sm">Simple Measure</p>
|
| 247 |
+
</div>
|
| 248 |
+
<div id="smogIndex" class="text-2xl font-bold text-purple-400">--</div>
|
| 249 |
+
</div>
|
| 250 |
+
</div>
|
| 251 |
+
|
| 252 |
+
<div class="bg-white/10 backdrop-blur-lg rounded-xl p-4 border border-white/20 hover-scale">
|
| 253 |
+
<div class="flex items-center justify-between">
|
| 254 |
+
<div>
|
| 255 |
+
<h4 class="text-white font-medium">Sentences</h4>
|
| 256 |
+
<p class="text-white/60 text-sm">Total count</p>
|
| 257 |
+
</div>
|
| 258 |
+
<div id="sentenceCount" class="text-2xl font-bold text-yellow-400">--</div>
|
| 259 |
+
</div>
|
| 260 |
+
</div>
|
| 261 |
+
|
| 262 |
+
<div class="bg-white/10 backdrop-blur-lg rounded-xl p-4 border border-white/20 hover-scale">
|
| 263 |
+
<div class="flex items-center justify-between">
|
| 264 |
+
<div>
|
| 265 |
+
<h4 class="text-white font-medium">Avg Words/Sentence</h4>
|
| 266 |
+
<p class="text-white/60 text-sm">Optimal: 15-20</p>
|
| 267 |
+
</div>
|
| 268 |
+
<div id="avgWordsPerSentence" class="text-2xl font-bold text-orange-400">--</div>
|
| 269 |
+
</div>
|
| 270 |
+
</div>
|
| 271 |
+
|
| 272 |
+
<div class="bg-white/10 backdrop-blur-lg rounded-xl p-4 border border-white/20 hover-scale">
|
| 273 |
+
<div class="flex items-center justify-between">
|
| 274 |
+
<div>
|
| 275 |
+
<h4 class="text-white font-medium">Complex Words</h4>
|
| 276 |
+
<p class="text-white/60 text-sm">3+ syllables</p>
|
| 277 |
+
</div>
|
| 278 |
+
<div id="complexWords" class="text-2xl font-bold text-red-400">--</div>
|
| 279 |
+
</div>
|
| 280 |
+
</div>
|
| 281 |
+
</div>
|
| 282 |
+
|
| 283 |
+
<!-- Recommendations -->
|
| 284 |
+
<div class="bg-white/10 backdrop-blur-lg rounded-2xl p-6 border border-white/20">
|
| 285 |
+
<h3 class="text-xl font-semibold text-white mb-4">
|
| 286 |
+
<i class="fas fa-lightbulb mr-2"></i>
|
| 287 |
+
AI Recommendations
|
| 288 |
+
</h3>
|
| 289 |
+
<ul id="recommendations" class="space-y-3">
|
| 290 |
+
<li class="text-white/80 italic">Analyzing your text for personalized recommendations...</li>
|
| 291 |
+
</ul>
|
| 292 |
+
</div>
|
| 293 |
+
</div>
|
| 294 |
+
</div>
|
| 295 |
+
</div>
|
| 296 |
+
|
| 297 |
+
<script>
|
| 298 |
+
class ReadabilityAnalyzer {
|
| 299 |
+
constructor() {
|
| 300 |
+
this.initializeElements();
|
| 301 |
+
this.bindEvents();
|
| 302 |
+
}
|
| 303 |
+
|
| 304 |
+
initializeElements() {
|
| 305 |
+
this.textInput = document.getElementById('textInput');
|
| 306 |
+
this.wordCount = document.getElementById('wordCount');
|
| 307 |
+
this.charCount = document.getElementById('charCount');
|
| 308 |
+
this.analyzeBtn = document.getElementById('analyzeBtn');
|
| 309 |
+
this.clearBtn = document.getElementById('clearBtn');
|
| 310 |
+
this.sampleBtn = document.getElementById('sampleBtn');
|
| 311 |
+
this.resultsSection = document.getElementById('resultsSection');
|
| 312 |
+
}
|
| 313 |
+
|
| 314 |
+
bindEvents() {
|
| 315 |
+
this.textInput.addEventListener('input', () => this.updateCounts());
|
| 316 |
+
this.analyzeBtn.addEventListener('click', () => this.analyze());
|
| 317 |
+
this.clearBtn.addEventListener('click', () => this.clear());
|
| 318 |
+
this.sampleBtn.addEventListener('click', () => this.loadSample());
|
| 319 |
+
}
|
| 320 |
+
|
| 321 |
+
updateCounts() {
|
| 322 |
+
const text = this.textInput.value;
|
| 323 |
+
const words = text.trim() ? text.trim().split(/\s+/).length : 0;
|
| 324 |
+
const chars = text.length;
|
| 325 |
+
|
| 326 |
+
this.wordCount.textContent = words;
|
| 327 |
+
this.charCount.textContent = chars;
|
| 328 |
+
}
|
| 329 |
+
|
| 330 |
+
clear() {
|
| 331 |
+
this.textInput.value = '';
|
| 332 |
+
this.wordCount.textContent = '0';
|
| 333 |
+
this.charCount.textContent = '0';
|
| 334 |
+
this.resultsSection.classList.add('hidden');
|
| 335 |
+
}
|
| 336 |
+
|
| 337 |
+
loadSample() {
|
| 338 |
+
const sampleText = `Artificial intelligence is transforming how we live and work. From personalized recommendations on streaming platforms to autonomous vehicles navigating city streets, AI applications are becoming increasingly sophisticated. Machine learning algorithms analyze vast amounts of data to identify patterns and make predictions, while natural language processing enables computers to understand and respond to human language. As these technologies continue to advance, they promise to revolutionize industries ranging from healthcare to finance, creating new opportunities and challenges for society. The integration of AI into daily life raises important questions about privacy, ethics, and the future of human-machine collaboration.`;
|
| 339 |
+
|
| 340 |
+
this.textInput.value = sampleText;
|
| 341 |
+
this.updateCounts();
|
| 342 |
+
this.analyze();
|
| 343 |
+
}
|
| 344 |
+
|
| 345 |
+
analyze() {
|
| 346 |
+
const text = this.textInput.value.trim();
|
| 347 |
+
if (!text) {
|
| 348 |
+
alert('Please enter some text to analyze.');
|
| 349 |
+
return;
|
| 350 |
+
}
|
| 351 |
+
|
| 352 |
+
this.resultsSection.classList.remove('hidden');
|
| 353 |
+
this.resultsSection.classList.add('fade-in');
|
| 354 |
+
|
| 355 |
+
const analysis = this.performAnalysis(text);
|
| 356 |
+
this.displayResults(analysis);
|
| 357 |
+
}
|
| 358 |
+
|
| 359 |
+
performAnalysis(text) {
|
| 360 |
+
const sentences = this.getSentences(text);
|
| 361 |
+
const words = this.getWords(text);
|
| 362 |
+
const syllables = words.reduce((sum, word) => sum + this.countSyllables(word), 0);
|
| 363 |
+
const complexWords = words.filter(word => this.countSyllables(word) >= 3).length;
|
| 364 |
+
|
| 365 |
+
const sentenceCount = sentences.length;
|
| 366 |
+
const wordCount = words.length;
|
| 367 |
+
const avgWordsPerSentence = wordCount / sentenceCount;
|
| 368 |
+
|
| 369 |
+
// Flesch Reading Ease
|
| 370 |
+
const fleschScore = Math.max(0, Math.min(100,
|
| 371 |
+
206.835 - 1.015 * avgWordsPerSentence - 84.6 * (syllables / wordCount)
|
| 372 |
+
));
|
| 373 |
+
|
| 374 |
+
// Flesch-Kincaid Grade Level
|
| 375 |
+
const fkGrade = Math.max(0,
|
| 376 |
+
0.39 * avgWordsPerSentence + 11.8 * (syllables / wordCount) - 15.59
|
| 377 |
+
);
|
| 378 |
+
|
| 379 |
+
// Gunning Fog Index
|
| 380 |
+
const fogIndex = 0.4 * (avgWordsPerSentence + 100 * (complexWords / wordCount));
|
| 381 |
+
|
| 382 |
+
// SMOG Index
|
| 383 |
+
const smogIndex = 1.043 * Math.sqrt(complexWords * (30 / sentenceCount)) + 3.1291;
|
| 384 |
+
|
| 385 |
+
// Reading time (assuming 200 WPM)
|
| 386 |
+
const readingTime = Math.ceil(wordCount / 200);
|
| 387 |
+
|
| 388 |
+
// Overall score (normalized to 0-100)
|
| 389 |
+
const overallScore = Math.round((fleschScore + (100 - fkGrade * 10) + (100 - fogIndex * 10) + (100 - smogIndex * 10)) / 4);
|
| 390 |
+
|
| 391 |
+
return {
|
| 392 |
+
fleschScore: Math.round(fleschScore),
|
| 393 |
+
fkGrade: Math.round(fkGrade * 10) / 10,
|
| 394 |
+
fogIndex: Math.round(fogIndex * 10) / 10,
|
| 395 |
+
smogIndex: Math.round(smogIndex * 10) / 10,
|
| 396 |
+
overallScore,
|
| 397 |
+
sentenceCount,
|
| 398 |
+
wordCount,
|
| 399 |
+
avgWordsPerSentence: Math.round(avgWordsPerSentence * 10) / 10,
|
| 400 |
+
complexWords,
|
| 401 |
+
readingTime
|
| 402 |
+
};
|
| 403 |
+
}
|
| 404 |
+
|
| 405 |
+
getSentences(text) {
|
| 406 |
+
return text.split(/[.!?]+/).filter(s => s.trim().length > 0);
|
| 407 |
+
}
|
| 408 |
+
|
| 409 |
+
getWords(text) {
|
| 410 |
+
return text.toLowerCase().match(/\b\w+\b/g) || [];
|
| 411 |
+
}
|
| 412 |
+
|
| 413 |
+
countSyllables(word) {
|
| 414 |
+
word = word.toLowerCase();
|
| 415 |
+
if (word.length <= 3) return 1;
|
| 416 |
+
|
| 417 |
+
const vowels = /[aeiouy]/g;
|
| 418 |
+
const matches = word.match(vowels);
|
| 419 |
+
if (!matches) return 1;
|
| 420 |
+
|
| 421 |
+
let syllableCount = matches.length;
|
| 422 |
+
|
| 423 |
+
// Handle special cases
|
| 424 |
+
if (word.endsWith('e')) syllableCount--;
|
| 425 |
+
if (word.endsWith('le') && word.length > 2 && word[word.length - 3] !== 'e') syllableCount++;
|
| 426 |
+
|
| 427 |
+
return Math.max(1, syllableCount);
|
| 428 |
+
}
|
| 429 |
+
|
| 430 |
+
displayResults(analysis) {
|
| 431 |
+
// Animate score circle
|
| 432 |
+
const scoreCircle = document.getElementById('scoreCircle');
|
| 433 |
+
const scorePercentage = analysis.overallScore / 100;
|
| 434 |
+
const offset = 351.86 - (351.86 * scorePercentage);
|
| 435 |
+
scoreCircle.style.strokeDashoffset = offset;
|
| 436 |
+
scoreCircle.style.stroke = analysis.overallScore >= 70 ? '#10b981' :
|
| 437 |
+
analysis.overallScore >= 50 ? '#f59e0b' : '#ef4444';
|
| 438 |
+
|
| 439 |
+
// Update display
|
| 440 |
+
document.getElementById('overallScore').textContent = analysis.overallScore;
|
| 441 |
+
document.getElementById('scoreText').textContent = this.getScoreText(analysis.overallScore);
|
| 442 |
+
document.getElementById('readingLevel').textContent = this.getReadingLevel(analysis.fkGrade);
|
| 443 |
+
document.getElementById('gradeLevel').textContent = `Grade ${analysis.fkGrade}`;
|
| 444 |
+
document.getElementById('readingTime').innerHTML = `<i class="fas fa-clock mr-2"></i>~${analysis.readingTime} min read`;
|
| 445 |
+
|
| 446 |
+
// Update metrics
|
| 447 |
+
document.getElementById('fleschScore').textContent = analysis.fleschScore;
|
| 448 |
+
document.getElementById('gunningFog').textContent = analysis.fogIndex;
|
| 449 |
+
document.getElementById('smogIndex').textContent = analysis.smogIndex;
|
| 450 |
+
document.getElementById('sentenceCount').textContent = analysis.sentenceCount;
|
| 451 |
+
document.getElementById('avgWordsPerSentence').textContent = analysis.avgWordsPerSentence;
|
| 452 |
+
document.getElementById('complexWords').textContent = analysis.complexWords;
|
| 453 |
+
|
| 454 |
+
// Generate recommendations
|
| 455 |
+
this.generateRecommendations(analysis);
|
| 456 |
+
}
|
| 457 |
+
|
| 458 |
+
getScoreText(score) {
|
| 459 |
+
if (score >= 90) return 'Very Easy to Read';
|
| 460 |
+
if (score >= 80) return 'Easy to Read';
|
| 461 |
+
if (score >= 70) return 'Fairly Easy to Read';
|
| 462 |
+
if (score >= 60) return 'Standard';
|
| 463 |
+
if (score >= 50) return 'Fairly Difficult';
|
| 464 |
+
if (score >= 30) return 'Difficult';
|
| 465 |
+
return 'Very Difficult';
|
| 466 |
+
}
|
| 467 |
+
|
| 468 |
+
getReadingLevel(grade) {
|
| 469 |
+
if (grade <= 5) return 'Elementary';
|
| 470 |
+
if (grade <= 8) return 'Middle School';
|
| 471 |
+
if (grade <= 12) return 'High School';
|
| 472 |
+
if (grade <= 16) return 'College';
|
| 473 |
+
return 'Graduate';
|
| 474 |
+
}
|
| 475 |
+
|
| 476 |
+
generateRecommendations(analysis) {
|
| 477 |
+
const recommendations = [];
|
| 478 |
+
|
| 479 |
+
if (analysis.avgWordsPerSentence > 20) {
|
| 480 |
+
recommendations.push('Consider breaking long sentences into shorter ones for better readability.');
|
| 481 |
+
}
|
| 482 |
+
|
| 483 |
+
if (analysis.complexWords > analysis.wordCount * 0.15) {
|
| 484 |
+
recommendations.push('Try replacing some complex words (3+ syllables) with simpler alternatives.');
|
| 485 |
+
}
|
| 486 |
+
|
| 487 |
+
if (analysis.fleschScore < 50) {
|
| 488 |
+
recommendations.push('Use shorter words and sentences to improve readability.');
|
| 489 |
+
}
|
| 490 |
+
|
| 491 |
+
if (analysis.fogIndex > 12) {
|
| 492 |
+
recommendations.push('Your text may be too complex for general audiences. Simplify where possible.');
|
| 493 |
+
}
|
| 494 |
+
|
| 495 |
+
if (analysis.sentenceCount < 5) {
|
| 496 |
+
recommendations.push('Consider adding more sentences to provide better context.');
|
| 497 |
+
}
|
| 498 |
+
|
| 499 |
+
if (recommendations.length === 0) {
|
| 500 |
+
recommendations.push('Great job! Your text has excellent readability.');
|
| 501 |
+
}
|
| 502 |
+
|
| 503 |
+
const recommendationsList = document.getElementById('recommendations');
|
| 504 |
+
recommendationsList.innerHTML = recommendations.map(rec =>
|
| 505 |
+
`<li class="text-white/80 flex items-start">
|
| 506 |
+
<i class="fas fa-check-circle text-green-400 mr-3 mt-1 flex-shrink-0"></i>
|
| 507 |
+
${rec}
|
| 508 |
+
</li>`
|
| 509 |
+
).join('');
|
| 510 |
+
}
|
| 511 |
+
}
|
| 512 |
+
|
| 513 |
+
// Initialize the analyzer
|
| 514 |
+
const analyzer = new ReadabilityAnalyzer();
|
| 515 |
+
</script>
|
| 516 |
+
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=dominiklukes/readability-analyzer" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 517 |
+
</html>
|