Translating Pig Latin with Flatten and Reduce

Let's build a fascinating application that converts normal language to Pig Latin using 'map', 'mergeMap' and, 'reduce' operators from RxJS.

Pig Latin is a silly pseudo language based on English. Translating an English sentence into Pig Latin is simple. Split each sentence into words and put each word through the following modifications:

  • Remove the first letter of each word: “Pig Latin” becomes “ig atin” (exception: ignore single-letter words)

  • Add the first letter removed in the previous step plus “ay” to the end of the word: "ig-pay atin-lay"

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy