Grammer checker

document.write(''); Grammar Checker
CSS (styles.css):body { font-family: Arial, sans-serif; text-align: center; margin: 20px; } textarea { width: 80%; height: 100px; margin-bottom: 10px; } button { padding: 10px; cursor: pointer; } #result { margin-top: 10px; }JavaScript (script.js):function checkGrammar() { const textInput = document.getElementById("textInput").value; const errors = findGrammarErrors(textInput); if (errors.length === 0) { document.getElementById("result").innerHTML = "No grammar errors found!"; } else { document.getElementById("result").innerHTML = "Grammar errors found:
" + errors.join("
"); } } function findGrammarErrors(text) { // Simple rule-based grammar check (you can extend this based on your needs) const sentences = text.split(/[.!?]/); const errors = sentences.filter(sentence => { // Example rule: Check if a sentence ends with a period. return sentence.trim() !== "" && !sentence.trim().endsWith("."); }); document.write(''); return errors; }This is a very basic example and might not cover all grammatical issues. For a more robust solution, you would need to use natural language processing libraries or APIs.

Comments

Popular Posts