Coder Social home page Coder Social logo

map-reduce's Introduction

Description

These python scripts use the mrjob package to search the GDELT data set for particular patterns or words. It then returns the number of times that word occurs inside files contained within the specified directory.  There are two scripts that return a slightly different count. These are:

line_count.py

The line_count.py script returns the number of lines where the word occurs. If the word occurs more than once in a line it will only be counted once.

word_count.py

The word_count.py script returns the total amount of times the word occurs. If the word occurs eight times in a line it will be counted eight times.


Inputs

Both programs take two string inputs. These inputs should be typed directly after the script name separated by a single space in the command line in the following order (see examples section):

  1. A directory to search (eg. /home/path/to/gdelt)
  2. A word to search for (eg. Africa)

Output

The output will be a string of the following format: "word-that-was-searched"    count


Examples

Linux:

Comand:

python line_count.py /home/path/to/gdelt Africa

Output:

"Africa"        13045

Windows:

Comand:

python word_count.py "C:\\path\to\gdelt" Africa

Output:

"Africa"        27693

map-reduce's People

Contributors

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