• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: jmlbeud ceararhtcs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: jmlbeud ceararhtcs


  • Subject: Re: jmlbeud ceararhtcs
  • From: Deivy Petrescu <email@hidden>
  • Date: Sun, 21 Sep 2003 20:50:45 -0400

This does a good and fast job.
___
set theText to "In the end it's not surprising that we can figure the sentences out. The error correction, like a CRC check or Hamming code in the digital world, is built into the language. Most European languages have similar levels of redundancy (excess information). It would have been more interesting if Shannon had not used printed language and had dealt with the phonemic transcription of spoken language instead. I've been meaning to do this for years, and I suspect that there is still a lot of redundancy (which is why spoken the word is so robust to audio quality degradation while remaining comprehensible), but something less than in written english (because the phonemic representation is more compact)."

repeat with wc from 1 to (count of words in theText)
repeat 1 times
set wwc to (word wc of theText)
set lwwc to ((length of wwc) + 1)
if lwwc is less than 5 then exit repeat
set oswc to ((offset of wwc in theText) - 1)
set secpart to oswc + lwwc
if wc = 1 then
set theText to scramble(wwc) & text lwwc thru -1 of theText
else
log {oswc, wwc}
set theText to (text 1 thru oswc of theText) & scramble(wwc) & (text secpart thru -1 of theText)
end if
end repeat
end repeat

theText



to scramble(wordtoscramble)
if length of wordtoscramble < 4 then return wordtoscramble
set empty to {}
set zt to characters 2 thru -2 of wordtoscramble
set lzt to length of zt
repeat with k from lzt to 1 by -1
set rk to random number from 1 to k
log rk
set end of empty to item rk of zt
log empty
if rk = 1 then
set zt to rest of zt
else if rk = lzt then
set zt to reverse of (rest of reverse of zt)
else
set zt to (items 1 thru (rk - 1) of zt) & (items (rk + 1) thru lzt of zt)
end if
set lzt to length of zt
end repeat
return ((character 1 of wordtoscramble) & (empty as string) & (character -1 of wordtoscramble)) as string
end scramble
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
References: 
 >jmlbeud ceararhtcs (From: Brennan <email@hidden>)

  • Prev by Date: Re: if clauses: multiple values in one test?
  • Next by Date: Folder actions and Script Debugger (was"Re: if clauses: multiple values in one test?")
  • Previous by thread: Re: jmlbeud ceararhtcs
  • Next by thread: Re: jmlbeud ceararhtcs
  • Index(es):
    • Date
    • Thread