Coder Social home page Coder Social logo

sentenceanalyzer's Introduction

Sentence Word Statistics Analyzer

This Python script analyzes a given sentence and provides various statistics about the words in the sentence. It calculates the total number of words, the number of unique words, the average word length, and the frequency of each word. Additionally, it identifies the longest and shortest words in the sentence.

Usage

  1. Make sure you have Python installed on your system.

  2. Clone or download this repository to your local machine:

    git clone https://github.com/your-username/sentence-word-stats.git
  3. Navigate to the project directory:

    cd sentence-word-stats
    
  4. Run the script:

    python sentence_stats.py
    
  5. Enter a sentence when prompted. The script will then process the input and display the word statistics.

Features

Calculates the total number of words in the sentence. Determines the number of unique words in the sentence. Computes the average word length in the sentence. Generates a frequency count of each word using the Counter class. Identifies the longest and shortest words in the sentence.

Example

Let's say you run the script and enter the sentence: "The quick brown fox jumps over the lazy dog."

The script will output:

Enter a sentence: The quick brown fox jumps over the lazy dog.
Number of all words in the sentence: 9
Number of unique words in the sentence: 8
Average word length: 4.444444444444445
Longest word: jumps
Shortest word: The
Word Frequency: Counter({'the': 2, 'quick': 1, 'brown': 1, 'fox': 1, 'jumps': 1, 'over': 1, 'lazy': 1, 'dog': 1})

Contributing

Contributions are welcome! If you find any issues or have suggestions for improvement, feel free to open an issue or a pull request in this repository.

License

This project is licensed under the MIT License - see the LICENSE file for details.

sentenceanalyzer's People

Contributors

jaypasnagasai avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.