09.10.2023 Views

Advanced Data Analytics Using Python_ With Machine Learning, Deep Learning and NLP Examples ( 2023)

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 7

Analytics at Scale

public abstract class RootBDAS {

abstract HashMap<String, ArrayList<String>>

mapper_task(String line);

abstract HashMap<String, ArrayList<String>>

reducer_task(String key, ArrayList<String> values);

}

Here is the child class:

import java.util.ArrayList;

import java.util.HashMap;

/**

*

*/

/**

* @author SayanM

*

*/

public final class WordCounterBDAS extends RootBDAS{

@Override

HashMap<String, ArrayList<String>> mapper_task

(String line) {

// TODO Auto-generated method stub

String[] words = line.split(" ");

HashMap<String, ArrayList<String>> result = new

HashMap<String, ArrayList<String>>();

for(String w : words)

{

if(result.containsKey(w))

149

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!