Git Product home page Git Product logo

noknok_coding_challenge's Introduction

Brief Description of the Task 1:

The task is to request urls and find the top 3 most frequently occuring words in a list of webpages and display them in decreasing order of their frequency.

Brief Description of the Task 2:

The task is to find the occurences of all the words in a text file and display them in a decreasing order of their frequency across all the urls.

Setup and Installations:

These commands are for a linux system. The commands were run on ubuntu 20.04 version. The text editor was vscode.

1) Run the following commands from the command line and directory noknok_cc.

$ sudo apt install python3-venv
$ python3 -m venv env
$ source env/bin/activate
$ pip install -r requirements.txt

Make sure you run the following command inside the noknok_cc folder which is the zipped file

2) Select the interpreter by going to

view->command palette->select interpreter Now select the python interpreter that is corresponding to your virtual environment.

Folder Structure:

noknok_cc
┣ utils
┃ ┣ helpers.py
┃ ┗ output_utils.py
┣ Coding Challenge 2022.pdf
┣ main.py
┣ readme.md
┣ urls.txt
┗ words.txt

The files helpers.py and output_utils.py contain the core functionality of the project. Description of each of the functions is given in the files itself. The files urls.txt contains the list of urls and words.txt contains the list of words to be queried.

Libraries used:

requests: Sends a get, put, or post request to the requested url collections: Package used to convert a dictionary to counter for easy addition of two dictionaries. argparse: To get the command line inputs and fpass these values to the required functions.

Running the python file

To run the program after the libraries have been installed run the following command from inside the folder noknok_cc:

$ python main.py --url_file <path_to_your_url_file> --word_file  <path_to_your_word_file>

References used:

https://docs.python.org/3/tutorial/errors.html
https://www.geeksforgeeks.org/read-a-file-line-by-line-in-python/
https://pip.pypa.io/en/stable/cli/pip_freeze/

noknok_coding_challenge's People

Contributors

manthan-a-mehta 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.