English To Pig Latin

Don't know why you would need this...

https://snap.berkeley.edu/snap/snap.html#present:Username=joecooldoo&ProjectName=English%20To%20Pig%20Latin

Currently, symbols are not corrected (Code wasn't working).

Nice :3
Igpay Atinlay siay unfay otay peaksay niay.

Pig Latin Is Nice To Speak In.

It is fun instead of nice, but yes :3

UPDATE: Added capitalization!

"Ellohay romfay hetay theroay iiiiiiiiidesay!" Upersay xcitedeay orfay hetay ewnay Deleaay lbumaay.

image
Uh...
Also,
image

can be simplified to
image

"ht my ccomradecomrade"
Yep, that's an issue.

histay sn'tiay orkingway.
English To Pig Latin script pic

"W f pphoton ttorpedoes!torpedoes"

@helicoptur and @sir_kitten2, did you read the comment?

Yes but my brain forgot about it.

um...
English To Pig Latin script pic

it should say "egolay atmanbay" (or "ego-lay atman-bay")

Yeah, it doesnt work well.

You're too fond of the SPLIT block. This is at its heart a job for recursion:


untitled script pic (4)
(This uses the Words and Sentences library, which you should load as the first step in solving any problem involving text!)

Now you can add frills for individual words:


Note that the first IF uses a recursive call; the only call to SIMPLE PIG LATIN is in the simple case at the end. This ensures that a word with an initial capital vowel is handled correctly.

Finally, you can handle multiple words this way:



If you don't like the handling of the ! the place to fix it is in another IF in word to pig latin, with a recursive call as in the case of initial capitals.

The red SENTENCE block is used here to convert a string of words into a list of words. (It can do other things, too.) It takes care of leading, trailing, and/or multiple spaces correctly.

P.S. Here it is.

P.P.S. You are of the "yay" sect; I am of the "way" sect. ;~)

I'm of the "ay" sect.

also, here's my code, very messy though.


https://snap.berkeley.edu/snap/snap.html#present:Username=ego-lay_atman-bay&ProjectName=pig%20latin%20translator

So am I, in practice, because it avoids hairing up the code unnecessarily. :~)

[Dons teacher hat.] Your code is messy for two reasons:

  1. You don't instinctively create well-named helper procedures to make your code self-documenting. In my version, for example, I didn't even have to show the code for VOWEL?, CAPITALIZE, ALL BUT FIRST LETTER OF, etc., to make the inner workings of the definitions I did show apparent.

  2. You don't see this as a fundamentally recursive problem. I don't know whether that's because you're iffy on recursion in general or you've just been poisoned too long by a looping perspective on pig Latin in particular. When teaching younger kids I just show what I've here called SIMPLE PIG LATIN as the complete solution.

oh, no, I actually thought about it after I made my code. I would've used recursion if I didn't start making it a map block.

(oh wait, I forgot to convert the list to text, lol)

that may be true

this is actually my first time making a functional pig latin translator (I have an unfinished one on scratch, made before I knew about snap)

It says “lol” is “lay” but “lol” is actually “ollay”