A simple web-based tool that allows users to analyze the text they input, providing various statistics such as word count, character count, sentence count, paragraph count, and syllable count.
You can try the Text Analyzer live at: https://text-analyzer-tool.netlify.app
- Analyze the text entered by the user
- Display the word count, character count, sentence count, paragraph count, and syllable count
- Automatically updates the statistics as the user types or pastes text
- HTML
- CSS
- JavaScript
- Type or paste your text into the provided text area.
- The text analyzer will automatically display the statistics for the entered text.
The code consists of an HTML structure, a CSS stylesheet, and a JavaScript file that handles the text analysis functionality.
The HTML file sets up the basic structure of the webpage, including:
- A container div to hold the content
- A text area for the user to input text
- Div elements to display the various text statistics
The CSS file styles the webpage, including:
- Setting the font and background colors
- Centering the content on the page
- Styling the text area and result containers
The JavaScript code handles the text analysis functionality:
-
The event listener on the text area:
- Retrieves the text entered by the user
- Calls the appropriate functions to calculate the various text statistics
- Updates the corresponding result elements with the calculated values
-
The
countSyllables()
function:- Implements a simple syllable counting algorithm
- Splits the text into words and counts the syllables for each word
- Returns the total syllable count for the given text
The JavaScript code updates the word count, character count, sentence count, paragraph count, and syllable count in real-time as the user types or pastes text into the text area.
To use the Text Analyzer, simply copy the HTML, CSS, and JavaScript code provided and save them in your project directory. You can then open the HTML file in a web browser to start using the application.
Contributions to this project are welcome. If you find any issues or have suggestions for improvements, please feel free to open a new issue or submit a pull request on the GitHub repository.