Pages

Saturday, 30 November 2024

Duplicate Sentence Checker/Remover Tool



Duplicate Sentence Checker/Remover

Duplicate Sentence Checker/Remover

Processed Text:

* { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: 'Roboto', sans-serif; background-color: #f7f7f7; display: flex; justify-content: center; align-items: center; height: 100vh; } .container { background-color: white; padding: 20px; border-radius: 8px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); width: 100%; max-width: 800px; text-align: center; } h1 { color: #333; margin-bottom: 20px; } textarea { width: 100%; padding: 10px; border-radius: 5px; border: 1px solid #ddd; resize: vertical; font-size: 14px; color: #333; margin-bottom: 15px; } textarea:focus { border-color: #5e9ed6; outline: none; } .buttons { margin-bottom: 20px; } button { background-color: #4caf50; color: white; padding: 10px 20px; border: none; border-radius: 5px; cursor: pointer; margin: 0 10px; transition: background-color 0.3s ease; } button:hover { background-color: #45a049; } h2 { margin-top: 20px; color: #333; } #outputText { background-color: #f4f4f4; border: 1px solid #ddd; font-size: 14px; } // Function to check for duplicate sentences document.getElementById('checkDuplicates').addEventListener('click', function() { let inputText = document.getElementById('inputText').value.trim(); if (inputText === "") { alert("Please enter some text to check for duplicates."); return; } // Split input text into sentences (assuming sentences end with a period) let sentences = inputText.split('.').map(sentence => sentence.trim()).filter(sentence => sentence !== ""); // Create a Set to remove duplicates let uniqueSentences = [...new Set(sentences)]; // Show processed text in output document.getElementById('outputText').value = uniqueSentences.join('. ') + '.'; }); // Function to remove duplicate sentences from the input document.getElementById('removeDuplicates').addEventListener('click', function() { let inputText = document.getElementById('inputText').value.trim(); if (inputText === "") { alert("Please enter some text to remove duplicates."); return; } // Split input text into sentences (assuming sentences end with a period) let sentences = inputText.split('.').map(sentence => sentence.trim()).filter(sentence => sentence !== ""); // Create a Set to remove duplicates let uniqueSentences = [...new Set(sentences)]; // Show processed text in output document.getElementById('outputText').value = uniqueSentences.join('. ') + '.'; });