April 2017
Intermediate to advanced
532 pages
12h 39m
English
The first step in our text processing pipeline is to split up the raw text content in each document into a collection of terms (also referred to as tokens). This is known as tokenization. We will start by applying a simple whitespace tokenization, together with converting each token to lowercase for each document:
val text = rdd.map { case (file, text) => text } val whiteSpaceSplit = text.flatMap(t => t.split(" ").map(_.toLowerCase)) println(whiteSpaceSplit.distinct.count)
Read now
Unlock full access