Giter Site home page Giter Site logo

cc-cw's Introduction

Anagrams MapReduce

University Project: โ˜ 18COC105 Cloud Computing

cc-cw/src/Anagrams.kt

Lines 21 to 24 in a41745f

/**
* Performs parsing of text into tokens of words, then builds sets of words which anagram together.
*/
class Anagrams : Configured(), Tool {

cc-cw/src/Anagrams.kt

Lines 25 to 33 in a41745f

/**
* Mapper to extract words from text. Parses text, extracting all words which can be anagram of another word
* (i.e. ignores single letter words and words with all the same letter, which can never be anagram'd).
*
* Normalises text by splitting on specific word boundaries, removing numbers and words with numbers.
* โ€ข Input is line number of input text [LongWritable] and string in [Text].
* โ€ข Output is word with letters in alphabetical order as [Text] and [SetWritable] containing original form of word.
*/
class AnagramMapper : Mapper<LongWritable, Text, Text, SetWritable>() {

cc-cw/src/Anagrams.kt

Lines 155 to 160 in a41745f

/**
* Partition based on length of word. This is for performance since words of different length will never anagram with
* each other. The more partitions available, the more different word lengths can be spread out across them and the
* less each partition will check keys for a word of different length.
*/
class AnagramPartitioner : Partitioner<Text, SetWritable>() {

cc-cw/src/Anagrams.kt

Lines 168 to 172 in a41745f

/**
* Reducer for performing anagram operation on words with matching alphabetically ordered letters (i.e. words which
* are anagrams of each other or are the same word).
*/
class AnagramReducer : Reducer<Text, SetWritable, Text, SetWritable>() {

cc-cw's People

Contributors

grgar avatar

Stargazers

 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.