This repository was archived by the owner on May 2, 2024. It is now read-only.

Dolfost/wfreq

Repository files navigation

Word frequency bar chart generator.

$ lua wfreq.lua --file hamlet.txt -m 20 -- --title "Words" --rotation 45 --label -x "Words" -y "Quantity"

Hamlet

$ lua wfreq.lua -f 1984.txt -m 15 -- --title 'Words' --rotation -45 --label -x "Words" -y "Quantity"

1984

$ lua wfreq.lua --help
Usage: wfreq [-h] [--max NUM] --file FILE [--version] [<pygram>] ...

Linkage script beetween Lab_4.4 and Pygram.

Arguments:
   pygram

Options:
   -h, --help            Show this help message and exit.
   --max NUM,            Max word count returned from Lab 4.4. Also the max bars
      -m NUM             to be shown in Pygram.
   --file FILE,          Input text file.
       -f FILE
   --version, -v         Print version and exit.

Typical format:
  $ wfreq <wfreq.lua options> [-- <pygram.py options>]
Where:
   <wfreq.lua options> Are shown above.
   <pygram.py options> You can check them with
                       $ python3 Pygram/pygram.py --help

Example usage:
  $ lua wfreq.lua -f hamlet.txt -m 20 -- --title Words --rotation 90
    --label -x "Words" -y "Quantity"
  1. Clone the repo with git
    $ git clone --recurse-submodules https://.com/Dolfost/wfreq
    
  2. Build the lab4.4 with build.sh
    $ cd Lab_4.4
    $ chmod +x build.sh
    $ ./build.sh
    $ cd ..
    
  3. Install Lua v5.3 and higher
    $ brew install lua
    
  4. Install luarocks
    $ brew install luarocks
    
  5. Install Lua dependencies
    $ luarocks install argparse
    
  6. Install python v3.0 and higher
    $ brew install python3
    
  7. Install python dependencies
    $ pip install -U matplotlib
    
  8. Ejoy!

Note that you might want to use different pakage manager than homebrew.