How to Use the Calculator
- Paste or type your text in the text input area.
- Click the "Calculate" button to analyze the text.
- The calculator will display three metrics:
- Total Words - The total number of words in your text.
- Average Word Length - The average number of characters per word.
- Unique Words - The number of distinct words in your text.
Calculation Methodology
The calculator uses the following methods to analyze text:
- Word counting is performed by splitting the text on whitespace characters and filtering out empty strings.
- Average word length is calculated by dividing the total number of characters by the total number of words.
- Unique words are identified by converting all words to lowercase and adding them to a JavaScript Set, which automatically handles uniqueness.
Example
For the text "Hello world! Hello everyone. Welcome to the world of calculators."
Results would be:
- Total Words: 9
- Average Word Length: 4.78
- Unique Words: 8
Note: Punctuation marks are not considered words. Numbers are counted as words.