by _bxg1 · 6y ago · 0 comments
document.querySelectorAll(`p`).forEach(el => {
el.textContent = el.textContent.replace(/[\s]i[\s]/g, ' I ');
el.textContent = el.textContent.split(/\.[\s]+/g)
.filter(sent => !!sent)
.map(sent => sent[0].toUpperCase() + sent.substr(1))
.join('. ');
})
Edit: Tweaked to filter out empty strings because it died about 80% of the way down the pageHowever, your heuristic worked because the content of the article was crap. Or to be more charitable: over-promised with a good idea and under-delivered with incompetent data-analysis, mangled conclusions, and ax-grinding (reiterating an opinion that he admits isn't supported by his data).
Sadly, it gives us another data point: a person who doesn't follow "fake rules" and totally uses "totes" in comments didn't write a good article. not a good look