DropTheHQ commited on
Commit
7fc8302
·
verified ·
1 Parent(s): 1c9cb67

Upload index.html with huggingface_hub

Browse files
Files changed (1) hide show
  1. index.html +222 -19
index.html CHANGED
@@ -1,19 +1,222 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 Checker - Facil.guide</title>
7
+ <style>
8
+ * { margin: 0; padding: 0; box-sizing: border-box; }
9
+ body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f5f5f0; color: #2d2d2d; min-height: 100vh; }
10
+ .header { background: #fff; border-bottom: 2px solid #069494; padding: 20px 32px; display: flex; align-items: center; justify-content: space-between; }
11
+ .header h1 { font-size: 22px; font-weight: 700; color: #2d2d2d; }
12
+ .header h1 span { color: #069494; }
13
+ .header a { color: #069494; text-decoration: none; font-size: 14px; font-weight: 600; }
14
+ .container { max-width: 800px; margin: 0 auto; padding: 32px 20px; }
15
+ .lang-row { display: flex; gap: 8px; margin-bottom: 20px; }
16
+ .lang-btn { padding: 8px 16px; border-radius: 8px; border: 2px solid #ddd; background: #fff; color: #666; cursor: pointer; font-size: 14px; font-weight: 600; transition: all 0.2s; }
17
+ .lang-btn:hover, .lang-btn.active { border-color: #069494; color: #069494; background: #e8f5f5; }
18
+ textarea { width: 100%; height: 220px; padding: 20px; border-radius: 12px; border: 2px solid #ddd; background: #fff; color: #2d2d2d; font-size: 16px; line-height: 1.8; outline: none; resize: vertical; margin-bottom: 20px; }
19
+ textarea:focus { border-color: #069494; }
20
+ textarea::placeholder { color: #aaa; }
21
+ .btn-analyze { display: inline-block; padding: 14px 32px; border-radius: 10px; border: none; background: #069494; color: #fff; font-size: 16px; font-weight: 600; cursor: pointer; transition: background 0.2s; }
22
+ .btn-analyze:hover { background: #057878; }
23
+ .results { margin-top: 28px; display: none; }
24
+ .results.visible { display: block; }
25
+ .score-hero { background: #fff; border: 2px solid #ddd; border-radius: 16px; padding: 32px; text-align: center; margin-bottom: 20px; }
26
+ .score-hero .big-score { font-size: 72px; font-weight: 800; }
27
+ .score-hero .score-label { font-size: 18px; color: #666; margin-top: 4px; }
28
+ .score-hero .verdict { font-size: 20px; font-weight: 700; margin-top: 12px; padding: 8px 24px; border-radius: 8px; display: inline-block; }
29
+ .scores-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
30
+ .score-card { background: #fff; border: 2px solid #ddd; border-radius: 12px; padding: 24px; text-align: center; }
31
+ .score-card .sc-val { font-size: 36px; font-weight: 700; color: #069494; }
32
+ .score-card .sc-name { font-size: 13px; color: #888; margin-top: 4px; font-weight: 600; }
33
+ .score-card .sc-desc { font-size: 12px; color: #aaa; margin-top: 8px; line-height: 1.5; }
34
+ .text-stats { background: #fff; border: 2px solid #ddd; border-radius: 12px; padding: 24px; }
35
+ .text-stats h3 { font-size: 14px; text-transform: uppercase; letter-spacing: 1px; color: #888; margin-bottom: 16px; }
36
+ .stats-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #f0f0f0; }
37
+ .stats-row:last-child { border-bottom: none; }
38
+ .stats-row .sr-label { color: #666; font-size: 14px; }
39
+ .stats-row .sr-value { color: #2d2d2d; font-weight: 600; font-size: 14px; }
40
+ .footer { text-align: center; padding: 40px 20px; color: #999; font-size: 13px; }
41
+ .footer a { color: #069494; text-decoration: none; font-weight: 600; }
42
+ .tips { background: #e8f5f5; border: 2px solid #b2dfdb; border-radius: 12px; padding: 24px; margin-top: 20px; }
43
+ .tips h3 { color: #069494; font-size: 15px; margin-bottom: 12px; }
44
+ .tips ul { list-style: none; padding: 0; }
45
+ .tips li { padding: 6px 0; font-size: 14px; color: #555; line-height: 1.6; }
46
+ .tips li::before { content: "\2713"; color: #069494; font-weight: 700; margin-right: 8px; }
47
+ </style>
48
+ </head>
49
+ <body>
50
+
51
+ <div class="header">
52
+ <h1><span>facil</span>.guide Readability Checker</h1>
53
+ <a href="https://facil.guide" target="_blank">facil.guide</a>
54
+ </div>
55
+
56
+ <div class="container">
57
+ <div class="lang-row">
58
+ <div class="lang-btn active" data-lang="en">English</div>
59
+ <div class="lang-btn" data-lang="es">Espanol</div>
60
+ <div class="lang-btn" data-lang="fr">Francais</div>
61
+ <div class="lang-btn" data-lang="pt">Portugues</div>
62
+ <div class="lang-btn" data-lang="it">Italiano</div>
63
+ </div>
64
+
65
+ <textarea id="input" placeholder="Paste your text here to check its readability...&#10;&#10;For best results, paste at least 100 words. The tool will analyze sentence structure, word complexity, and syllable patterns to estimate how accessible your writing is."></textarea>
66
+
67
+ <button class="btn-analyze" id="analyze">Analyze Readability</button>
68
+
69
+ <div class="results" id="results">
70
+ <div class="score-hero">
71
+ <div class="big-score" id="flesch-score">--</div>
72
+ <div class="score-label">Flesch Reading Ease</div>
73
+ <div class="verdict" id="verdict">Paste text above</div>
74
+ </div>
75
+
76
+ <div class="scores-grid">
77
+ <div class="score-card">
78
+ <div class="sc-val" id="fk-grade">--</div>
79
+ <div class="sc-name">Flesch-Kincaid Grade</div>
80
+ <div class="sc-desc">US grade level needed to understand this text</div>
81
+ </div>
82
+ <div class="score-card">
83
+ <div class="sc-val" id="fog-index">--</div>
84
+ <div class="sc-name">Gunning Fog Index</div>
85
+ <div class="sc-desc">Years of education needed (lower = easier)</div>
86
+ </div>
87
+ <div class="score-card">
88
+ <div class="sc-val" id="cl-index">--</div>
89
+ <div class="sc-name">Coleman-Liau Index</div>
90
+ <div class="sc-desc">Grade level based on character count</div>
91
+ </div>
92
+ <div class="score-card">
93
+ <div class="sc-val" id="senior-score">--</div>
94
+ <div class="sc-name">Senior-Friendly Score</div>
95
+ <div class="sc-desc">Custom score: target 70+ for senior audiences</div>
96
+ </div>
97
+ </div>
98
+
99
+ <div class="text-stats">
100
+ <h3>Text Statistics</h3>
101
+ <div class="stats-row"><span class="sr-label">Words</span><span class="sr-value" id="st-words">0</span></div>
102
+ <div class="stats-row"><span class="sr-label">Sentences</span><span class="sr-value" id="st-sentences">0</span></div>
103
+ <div class="stats-row"><span class="sr-label">Syllables</span><span class="sr-value" id="st-syllables">0</span></div>
104
+ <div class="stats-row"><span class="sr-label">Avg Words/Sentence</span><span class="sr-value" id="st-avgwords">0</span></div>
105
+ <div class="stats-row"><span class="sr-label">Avg Syllables/Word</span><span class="sr-value" id="st-avgsyl">0</span></div>
106
+ <div class="stats-row"><span class="sr-label">Complex Words (3+ syllables)</span><span class="sr-value" id="st-complex">0</span></div>
107
+ </div>
108
+
109
+ <div class="tips">
110
+ <h3>Tips for Senior-Friendly Writing</h3>
111
+ <ul>
112
+ <li>Keep sentences under 20 words when possible</li>
113
+ <li>Use common, everyday vocabulary</li>
114
+ <li>Define technical terms when first used</li>
115
+ <li>Use active voice instead of passive</li>
116
+ <li>Break long paragraphs into shorter ones</li>
117
+ <li>Include step numbers for instructions</li>
118
+ </ul>
119
+ </div>
120
+ </div>
121
+ </div>
122
+
123
+ <div class="footer">
124
+ Built by <a href="https://facil.guide">Facil.guide</a> &mdash; Making technology accessible for everyone.<br>
125
+ Senior-friendly tech guides in 5 languages at <a href="https://facil.guide">facil.guide</a>
126
+ </div>
127
+
128
+ <script>
129
+ function countSyllables(word) {
130
+ word = word.toLowerCase().replace(/[^a-z]/g, '');
131
+ if (word.length <= 2) return 1;
132
+ word = word.replace(/(?:[^laeiouy]es|ed|[^laeiouy]e)$/, '');
133
+ word = word.replace(/^y/, '');
134
+ const m = word.match(/[aeiouy]{1,2}/g);
135
+ return m ? Math.max(1, m.length) : 1;
136
+ }
137
+
138
+ function analyze() {
139
+ const text = document.getElementById('input').value.trim();
140
+ if (!text) return;
141
+
142
+ const sentences = text.split(/[.!?]+/).filter(s => s.trim().length > 0);
143
+ const words = text.split(/\s+/).filter(w => w.replace(/[^a-zA-Z]/g, '').length > 0);
144
+ const numSentences = Math.max(1, sentences.length);
145
+ const numWords = words.length;
146
+
147
+ if (numWords < 5) return;
148
+
149
+ let totalSyllables = 0;
150
+ let complexWords = 0;
151
+ const totalChars = words.reduce((s, w) => s + w.replace(/[^a-zA-Z]/g, '').length, 0);
152
+
153
+ words.forEach(w => {
154
+ const s = countSyllables(w);
155
+ totalSyllables += s;
156
+ if (s >= 3) complexWords++;
157
+ });
158
+
159
+ const avgWordsPerSentence = numWords / numSentences;
160
+ const avgSylPerWord = totalSyllables / numWords;
161
+
162
+ // Flesch Reading Ease
163
+ const flesch = Math.round(206.835 - (1.015 * avgWordsPerSentence) - (84.6 * avgSylPerWord));
164
+ const fleschClamped = Math.max(0, Math.min(100, flesch));
165
+
166
+ // Flesch-Kincaid Grade
167
+ const fkGrade = ((0.39 * avgWordsPerSentence) + (11.8 * avgSylPerWord) - 15.59).toFixed(1);
168
+
169
+ // Gunning Fog
170
+ const fog = (0.4 * (avgWordsPerSentence + 100 * (complexWords / numWords))).toFixed(1);
171
+
172
+ // Coleman-Liau
173
+ const L = (totalChars / numWords) * 100;
174
+ const S = (numSentences / numWords) * 100;
175
+ const cl = ((0.0588 * L) - (0.296 * S) - 15.8).toFixed(1);
176
+
177
+ // Senior-Friendly (custom: weighted average favoring simplicity)
178
+ const senior = Math.round(fleschClamped * 0.6 + Math.max(0, 100 - parseFloat(fkGrade) * 8) * 0.4);
179
+
180
+ // Color + verdict
181
+ let color, verdict;
182
+ if (fleschClamped >= 80) { color = '#069494'; verdict = 'Very Easy - Great for seniors'; }
183
+ else if (fleschClamped >= 60) { color = '#4CAF50'; verdict = 'Standard - Accessible to most'; }
184
+ else if (fleschClamped >= 40) { color = '#FF9800'; verdict = 'Fairly Difficult'; }
185
+ else { color = '#f44336'; verdict = 'Difficult - Consider simplifying'; }
186
+
187
+ document.getElementById('results').classList.add('visible');
188
+ document.getElementById('flesch-score').textContent = fleschClamped;
189
+ document.getElementById('flesch-score').style.color = color;
190
+
191
+ const verdictEl = document.getElementById('verdict');
192
+ verdictEl.textContent = verdict;
193
+ verdictEl.style.background = color + '18';
194
+ verdictEl.style.color = color;
195
+
196
+ document.getElementById('fk-grade').textContent = fkGrade;
197
+ document.getElementById('fog-index').textContent = fog;
198
+ document.getElementById('cl-index').textContent = cl;
199
+ document.getElementById('senior-score').textContent = senior;
200
+
201
+ document.getElementById('st-words').textContent = numWords;
202
+ document.getElementById('st-sentences').textContent = numSentences;
203
+ document.getElementById('st-syllables').textContent = totalSyllables;
204
+ document.getElementById('st-avgwords').textContent = avgWordsPerSentence.toFixed(1);
205
+ document.getElementById('st-avgsyl').textContent = avgSylPerWord.toFixed(2);
206
+ document.getElementById('st-complex').textContent = complexWords + ' (' + ((complexWords/numWords)*100).toFixed(1) + '%)';
207
+ }
208
+
209
+ document.querySelectorAll('.lang-btn').forEach(b => {
210
+ b.addEventListener('click', () => {
211
+ document.querySelectorAll('.lang-btn').forEach(x => x.classList.remove('active'));
212
+ b.classList.add('active');
213
+ });
214
+ });
215
+
216
+ document.getElementById('analyze').addEventListener('click', analyze);
217
+ document.getElementById('input').addEventListener('keydown', (e) => {
218
+ if (e.key === 'Enter' && e.ctrlKey) analyze();
219
+ });
220
+ </script>
221
+ </body>
222
+ </html>