Coder Social home page Coder Social logo

abhishtagatya / zipflaw Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 2.0 31 KB

πŸ“‰ Zipf's Law in Natural Language word distribution

License: MIT License

Python 100.00%
data-science data-visualization mathematics statistics linguistics zipf matplotlib frequency natural-language

zipflaw's Introduction

Zipf's Law in Natural Language

Data Visualization using Python and Matplotlib

ZipfLaw

Trying it out

This project requires pip to run.

Clone the project and Install the Python requirements using pip.

$ git clone https://github.com/abhishtagatya/zipflaw
$ cd zipfLaw
$ pip install -r requirements.txt

Project directory

.
β”œβ”€β”€ data
β”‚   └── wordcount.json
β”œβ”€β”€ docs
β”‚   └── img
β”‚       └── zipf_py.png
β”œβ”€β”€ essay.txt
β”œβ”€β”€ LICENSE
β”œβ”€β”€ README.md
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ src
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ visual.py
└── zipf

Before running 'zipf', please add in some text in 'essay.txt' otherwise it will throw and error. Make sure to check out the 'wordcount.json' for the full visualization of the word frequencies.

The project is in 'src/visual.py' go tweak it to your liking.

About

The project was solely to learn about Zipf's Law on the frequency distribution of words. It was hypothesized that words such as (e.g., "the", "of", "and", "to", "a") are considered high-frequency words and words such as (e.g., β€œaccordion,” β€œcatamaran,” β€œravioli”) are considered low-frequency words (in english of course).

So I've decided to test out my programming skills to check whether this was true or not. You can definitely do this by yourself and add modifications to it if you see fit.

Although it works, it still lacks accuracy and good data visualization because for some reason Matplotlib messed up my arrangements and that is why you might see that it is not ordered correctly when displayed.

Note that when doing this, make sure you put in enough text in 'essay.txt' or any text file you want to feed it. It seems that the data is most accurate when given more text. So the longer the text the more accurate results you'll get.

Built With

Author

  • Abhishta Gatya - Computer Science Student

Reference

zipflaw's People

Contributors

abhishtagatya avatar

Stargazers

 avatar  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.