Map() method

The following are characteristics of the map function, including examples of the input and output.
  • Input: A file ID and a file content.
  • Output: A ('word', 1) pair for each word matching the regex.
  • Action: Splits every file content to single words and performs matching against given regEx

Input data

Regex: [A-Z][a-z]+[A-Z]
KEY | TEXT
-----+-----------------------------------
1 | GREP grep GreP gREp
2 | Grep example
3 | AbbA DooR MOON
4 | Ab bA Do oR Mo oN
5 | MooN Earth SuN
6 | BACKDooR SuNrise SuNset MooNlight

Intermediate output data

WORD | NUM
-----------+-------------
GreP | 1
AbbA | 1
DooR | 2
MooN | 2
SuN | 3
DooR | 1
SuN | 1
SuN | 1
MooN | 1