Author Topic: Insomnia? Simple, write a typoglycemia function.  (Read 6512 times)

0 Members and 1 Guest are viewing this topic.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Insomnia? Simple, write a typoglycemia function.
« on: April 29, 2005, 05:07:29 AM »
What?

Remember this nonesence, typoglycemia?

I cdnuolt blveiee taht I cluod aulaclty uesdnatnrd waht I was rdanieg The phaonmneal pweor of the hmuan mnid Aoccdrnig to rscheearch taem at Cmabrigde Uinervtisy, it deosn't mttaer in waht oredr the ltteers in a wrod are, the olny iprmoatnt tihng is taht the frist and lsat ltteer be in the rghit pclae. The rset can be a taotl mses and you can sitll raed it wouthit a porbelm. Tihs is bcuseae the huamn mnid deos not raed ervey lteter by istlef, but the wrod as a wlohe. Such a cdonition is arppoiately cllaed Typoglycemia :)- Amzanig huh? Yaeh and yuo awlyas thought slpeling was ipmorantt!

Well, when you have insomnia and need something mindless and mildy interesting to keep from going mad you write crud like this --

Code: [Select]
(defun typos ( text / scramble middle rotate main )

    (defun scramble ( codes )
        (if (< (length codes) 4)
            codes
            (append
                (list (car codes))
                (rotate (middle codes))
                (list (last codes))
            )
        )
    )
   
    (defun middle ( lst )
        (cdr
            (reverse
                (cdr
                    (reverse lst)
                )
            )
        )
    )

    (defun rotate ( lst )
        (cons
            (last lst)
            (reverse
                (cdr
                    (reverse lst)
                )
            )
        )
    )

    (defun main ( text / punc codes result )

        (setq punc
            (vl-string->list
                "\".?!:-,;/()[]{}\n\r\t "
            )
        )

        (foreach code

            (reverse
                (vl-string->list
                    (vl-string-trim
                        " \t\n"
                        text
                    )
                )
            )

            (cond
                (   (member code punc)
                    (if codes
                        (setq result
                            (cons
                                (scramble codes)
                                result
                            )
                            codes nil
                        )
                    )
                    (setq result
                        (cons
                            (list code)
                            result
                        )
                    )
                )
                (   (setq codes
                        (cons
                            code
                            codes
                        )
                    )
                )
            )
        )

        (vl-list->string
            (apply 'append
                (if codes
                    (cons
                        (scramble codes)
                        result
                    )
                    result
                )
            )
        )
    )

    (main text)

)

(typos "Now, whenever you feel the need to ...")

Now, wehenevr you feel the need to aonny yuor fdriens, or jsut slpel lkie Jhon, jsut psas yuor txet tghrouh tihs slimpe rnoutie!

Edit: Distilled routine.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Insomnia? Simple, write a typoglycemia function.
« Reply #1 on: April 29, 2005, 05:15:29 AM »
Insomnia, take a book to bed. I have broken several pairs of glasses doing just that.

coding for typoglycemia :
You raelly firgthen me Michael

:D

Dont let John near that code ...
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Insomnia? Simple, write a typoglycemia function.
« Reply #2 on: April 29, 2005, 05:20:13 AM »
Quote from: Kerry Brown
You raelly firgthen me Michael

I fhterign melysf dood! :shock:

Quote from: Kerry Brown
Dont let John near that code ...

Good one, it wulod rdeenr his slinpelg erorr fere. :lol:
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

MickD

  • King Gator
  • Posts: 3637
  • (x-in)->[process]->(y-out) ... simples!
Insomnia? Simple, write a typoglycemia function.
« Reply #3 on: April 29, 2005, 05:38:52 AM »
What's Typoglycemia??? :lol:

Seriously though, I had no trouble reading that post, is that a good thing?
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.”
- J.R.R. Tolkien

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Insomnia? Simple, write a typoglycemia function.
« Reply #4 on: April 29, 2005, 07:44:46 AM »
Oh my, if you can read that you have a case of it too.
I recommend bourbon, and lot's of it. :)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

daron

  • Guest
Insomnia? Simple, write a typoglycemia function.
« Reply #5 on: April 29, 2005, 07:51:23 AM »
That is cool.

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Insomnia? Simple, write a typoglycemia function.
« Reply #6 on: April 29, 2005, 09:18:05 AM »
MP - D@MN, thats cool
MickD - Good to see you here
CAB - Whose pouring?
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Insomnia? Simple, write a typoglycemia function.
« Reply #7 on: April 29, 2005, 10:10:12 AM »
Burbon (most alcohol) gives me terrible heartburn.

:(

Thanks anyway guys. I think I'll just get a large mallet to put beside the bed; could double for caveman foreplay.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

SMadsen

  • Guest
Insomnia? Simple, write a typoglycemia function.
« Reply #8 on: April 29, 2005, 05:33:05 PM »
Now the real task: scramble the code above and write a program that teaches the computer to deal with typoglycemia as well as humans deal with it.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Insomnia? Simple, write a typoglycemia function.
« Reply #9 on: April 29, 2005, 06:04:18 PM »
How about some pseudo code?

Code: [Select]
First have a dictionary sorted by first letter then by length then by last letter.
The dictionary is made of list grouped as sorted,

Convert the string into words, individual strings using space as the delimiter.
Loop through the list of strings.
If strings less than 4 letters
  add to reconstruct list plus space
Else
  Find the Dictionary list with the match of first char, last char & length match.
  Loop through the dictionary sub list
  Find the match for any word using the interior letters.
  add to reconstruct list plus space
Done.


Some words will not be processed correctly but you could restruct your dictionary
to push the high percentage words to the top.

Well never as good as the human computer. But it will give something for Michael to
do the next sleepless night. :)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Insomnia? Simple, write a typoglycemia function.
« Reply #10 on: April 29, 2005, 09:28:37 PM »
Fnuny sftuf gyus, lol.

If one wree to tkae tihs on sleriosuy the way to do it wloud be taht if run tcwie it wloud rretun the oariginl txet, saimilr to a slimpe xnorig eoncryptin smchee.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

pmvliet

  • Guest
Insomnia? Simple, write a typoglycemia function.
« Reply #11 on: May 05, 2005, 10:53:49 AM »
In a way reversing this is doable.
Text messaging in a Cell Phone has predictive text.
If there was s text database, the computer can identify the first and last letter, it can figure out how many character's long the word is
and compare that to the database...
How many words start with T, end with T and is 4 character's long...

ok... it's the middle of the day and not night time.  :D

Pieter

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Insomnia? Simple, write a typoglycemia function.
« Reply #12 on: May 05, 2005, 12:02:26 PM »
As stated, the easiest thing to imlement is a scheme, analagous to simple xoring bit twiddling, that results in the original string being generated if the routine is run twice.

This variant will do that:

Code: [Select]
(defun typos ( text / scramble middle group flip main )

    (defun scramble ( codes )
        (if (< (length codes) 4)
            codes
            (append
                (list (car codes))
                (flip (middle codes))
                (list (last codes))
            )
        )
    )

    (defun middle ( lst )
        (cdr
            (reverse
                (cdr
                    (reverse lst)
                )
            )
        )
    )

    (defun group ( lst len / group result )
        (foreach item lst
            (if
                (eq len
                    (length
                        (setq group
                            (cons item group)
                        )
                    )
                )
                (setq
                    result (cons group result)
                    group  nil
                )
            )
        )
        (reverse
            (mapcar 'reverse
                (if group
                    (cons group result)
                    result
                )
            )
        )
    )

    (defun flip ( lst )
        (apply 'append
            (mapcar 'reverse
                (group lst 2)
            )
        )
    )

    (defun main ( text / punc codes result )

        (setq punc
            (vl-string->list
                "\".?!:-,;/()[]{}\n\r\t "
            )
        )

        (foreach code

            (reverse
                (vl-string->list
                    (vl-string-trim
                        " \t\n"
                        text
                    )
                )
            )

            (cond
                (   (member code punc)
                    (if codes
                        (setq result
                            (cons
                                (scramble codes)
                                result
                            )
                            codes nil
                        )
                    )
                    (setq result
                        (cons
                            (list code)
                            result
                        )
                    )
                )
                (   (setq codes
                        (cons
                            code
                            codes
                        )
                    )
                )
            )
        )

        (vl-list->string
            (apply 'append
                (if codes
                    (cons
                        (scramble codes)
                        result
                    )
                    result
                )
            )
        )
    )

    (main text)

)

Example:

Code: [Select]
(setq JohnSpeak
    (typos
        (strcat
            "Admittedly, I am a hopeless nerd. "
            "I'm ok with that assessment."
        )
    )
)

=> "Amdtietldy, I am a hpoleses nred. I'm ok wtih taht asssemsnet."

(typos JohnSpeak)

=> "Admittedly, I am a hopeless nerd. I'm ok with that assessment."

:cheesy:
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

jonesy

  • SuperMod
  • Seagull
  • Posts: 15568
Re: Insomnia? Simple, write a typoglycemia function.
« Reply #13 on: May 09, 2005, 07:01:26 AM »
Quote from: MP
I cdnuolt blveiee taht I cluod aulaclty uesdnatnrd waht I was rdanieg The phaonmneal pweor of the hmuan mnid Aoccdrnig to rscheearch taem at Cmabrigde Uinervtisy, it deosn't mttaer in waht oredr the ltteers in a wrod are, the olny iprmoatnt tihng is taht the frist and lsat ltteer be in the rghit pclae. The rset can be a taotl mses and you can sitll raed it wouthit a porbelm. Tihs is bcuseae the huamn mnid deos not raed ervey lteter by istlef, but the wrod as a wlohe. Such a cdonition is arppoiately cllaed Typoglycemia :)- Amzanig huh? Yaeh and yuo awlyas thought slpeling was ipmorantt

If this is true how do dyslexic people read?
Thanks for explaining the word "many" to me, it means a lot.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Insomnia? Simple, write a typoglycemia function.
« Reply #14 on: May 09, 2005, 07:39:38 AM »
?siht ekil ti t'nsi tub ,sklof hcus fo thgil ekam ot hsiw t'nod I
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst