Giter Club home page Giter Club logo

typoglycaemic's Introduction

Typoglycaemic

Usage

require 'typoglycaemic'
words = <<~STR
According to a researcher at Cambridge University, it doesn't matter in what order the letters in a word are, the only important thing is that the first and last letter be at the right place. The rest can be a total mess and you can still read it without problem. This is because the human mind does not read every letter by itself but the word as a whole.
STR

puts Typoglycaemic(words).jumbled

The output:

Accorindg to a reeascrehr at Cmbairdge Uivnesrtiy, it deso'nt matter in what order the letters in a word are, the only ipmortnat tinhg is that the fisrt and last letter be at the rgiht pacle. The rset can be a toatl mses and you can still raed it wtiouht poblerm. Tihs is bceasue the huamn mnid does not read eevry letter by iteslf but the wrod as a wolhe.

str = "A doctor has admitted the manslaughter of a teenage cancer patient who died after a hospital drug blunder."
puts Typoglycaemic(str).jumbled

The output:

A docotr has amditted the mnsalugather of a teengae cnaecr ptiaent who died after a hspotail drug blnduer.

str = "In the Victorian era, a lovely emerald green, partially formulated from arsenic, was used in fabrics and popular floral headdresses."
puts Typoglycaemic(str).jumbled

The output:

In the Vitorcain era, a lovley emreald green, patirally fromlauetd form asenric, was uesd in fbarics and poplaur folarl headdersses.

The original is around if needed:

tc = Typoglycaemic(str)
tc.original

The rules

It follows the rules set out in this article.

Why this library?

Mainly because I was getting bored of debugging and wanted to do something else, but also because I read this:

In a final study, Gervais and Norenzayan used an even more subtle way of activating analytic thinking: by having participants fill out a survey measuring their religious beliefs that was printed in either clear font or font that was difficult to read. Prior research has shown that difficult-to-read font promotes analytic thinking by forcing participants to slow down and think more carefully about the meaning of what they are reading. The researchers found that participants who filled out a survey that was printed in unclear font expressed less belief as compared to those who filled out the same survey in the clear font.

How Critical Thinkers Lose Their Faith in God, Daisy Grewal, May 1, 2012, Scientific American

I might try using it on social networks when I want my "opponent" in a debate to bypass "System 1".

Installation

Add this line to your application's Gemfile:

gem 'typoglycaemic'

And then execute:

$ bundle

Or install it yourself as:

$ gem install typoglycaemic

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/yb66/typoglycaemic.

typoglycaemic's People

Contributors

yb66 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.