Time for action – counting frequent words by coding in JavaScript
In Chapter 4, Filtering, Searching, and Performing Other Useful Operations with Data, you created a transformation that read a file and counted frequent words. In this section, you will create a variant of that transformation by replacing some of the steps with a piece of JavaScript code.
- Open the transformation from the section named Counting frequent words by filtering from Chapter 4, Filtering, Searching, and Performing Other Useful Operations with Data. Select the first two steps—the Text file input and the Split field to rows steps—and copy them to a new transformation.
- From the Scripting category of steps, select and drag a Modified Java Script Value step to the work area. Create a hop from the Split field to rows step toward this. You will have the following:
- Double-click on the Modified Java Script Value step—MJSV from now on—and under the text
//Script here
, type the following:var...