[Solved-1 Solution] Convert sentence into Pig Latin in C++
Pig Latin - Data Model
- The data model of Pig is fully nested. A Relation is the outermost structure of the Pig Latin data model. And it is a bag where -
- A bag is a collection of tuples.
- A tuple is an ordered set of fields.
- A field is a piece of data.
Pig Latin - Statements
- While processing data using Pig Latin, statements are the basic constructs.
- These statements work with relations. They include expressions and schemas.
- Every statement ends with a semicolon (;).
- We will perform various operations using operators provided by Pig Latin, through statements.
- Except LOAD and STORE, while performing all other operations, Pig Latin statements take a relation as input and produce another relation as output.
- As soon as we enter a Load statement in the Grunt shell, its semantic checking will be carried out. To see the contents of the schema, you need to use the Dump operator. Only after performing the dump operation, the MapReduce job for loading the data into the file system will be carried out.
- The given statement loads the data into the apache pig
How to convert sentence into pig latin in C++ ?
There are few random ideas for convert a sentence into pig latin
- To piglatinze a word: if first letter is a vowel, trivial; if not, find the first vowel. Split the string into two parts; output second part plus first part plus "ay".
- To find a consonant, just test for "not a vowel". Basically, we only need one is_vowel()function.
- Use std::string Anything else you'd be doing would not be learning C++.
A C++ program to convert a sentence to Pig Latin