$piglatin

By enexif on Nov 09, 2005

Translates text into piglatin.. $piglatin(Text) ... See the code for example...

; $piglatin(text)
; Translates text into piglatin.
; Usage: $piglatin(My cat got expelled) would return
; Ymay Atcay Otgay Expelleday
; $piglatin(dog eat dog world) would return
; Ogday Eatay Ogday Orldway

alias piglatin {
  var %i = 1, %x = $numtok($1-,32)
  while (%i <= %x) {
    var %w = $gettok($1-,%i,32), %nword, %f
    if ($lower($left(%w,1)) isletter aeiou) { var %output = %output $+(%w,way) }
    else {
      var %n = 1
      while (%n <= $len(%w)) {
        var %c = $lower($mid(%w,%n,1))
        if (%c isletter aeiou) {
          var %nword = $+($right(%w,- $+ $calc(%n - 1)),$left(%w,$calc(%n - 1)),ay), %output = %output $upper($left(%nword,1)) $+ $lower($right(%nword,-1))
          var %f = 1
          break
        }
        else {
          if ((!$count(%w,a) && !$count(%w,e) && !$count(%w,i) && !$count(%w,o) && !$count(%w,u)) && %c == y) {
            var %nword = $+($right(%w,- $+ $calc(%n - 1)),$left(%w,$calc(%n - 1)),ay), %output = %output $upper($left(%nword,1)) $+ $lower($right(%nword,-1))
            var %f = 1
            break
          }
        }
        inc %n
      }
      if (!%f) { var %output = %output %w }
    }
    inc %i
  }
  return %output

}

Comments

Sign in to comment.
enexif   -  Nov 11, 2005

In response to Sasuke...

  • The example is wrong the code actually does put a \'way\' at the end when the beginning letter is vowel..
  • As far as the rules go with all constant letters going to the end, that works.. except for the \'quiet\' example. I have not been able to find a rule for that other than it must be done...
  • As far as the mismatched brackets. you Copied and Pasted Wrong..
  • Quoted from Sasuke (YOUR Version would change it to hankstay or hanksay)... My version does return anksthay..... [$piglatin(thanks) => Anksthay

My exmple was to prove that this can be done for any word the user inputs.. instead of having a huge list of words, which is alot, and just constantly doing $replace on them..

 Respond  
KuTsuM   -  Nov 10, 2005

there\'s no direct alias for it, you need to use the identifier in your code like
on 1:text:*:#: { echo -a $piglatin($1-) }

 Respond  
err2   -  Nov 10, 2005

... how duz it wrk?
i tried /piglatin but it duznt wrk
...

 Respond  
log2   -  Nov 10, 2005

Technically it\'s not either... it\'s supposed to be aa not ay or waa not way, and they are supposed to have an accent but I don\'t remember which one.

 Respond  
Sasuke   -  Nov 09, 2005

Pig latin is:
say you have the word Thanks
YOUR Version would change it to hankstay or hanksay
When in reality it\'s supposeda be anksthay

And if you have the word eat
its not eatay
its Eatway

 Respond  
Sasuke   -  Nov 09, 2005

And

; $piglatin(text)
; Translates text into piglatin.
; Usage: $piglatin(My cat got expelled) would return
; Ymay Atcay Otgay Expelleday
; $piglatin(dog eat dog world) would return
; Ogday Eatay Ogday Orldway

Supposeda be eatway

WAY PEOPLE

And Expelledway

DOES ANYBODY KNOW PIG LATIN???

 Respond  
Sasuke   -  Nov 09, 2005

Grr... because I just started a pig latin treand... THWACKS SELF

And it says mismatched brackets

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.