Showing posts with label random. Show all posts
Showing posts with label random. Show all posts

Tuesday, 10 March 2009

predictive text isotaps

So, ever since getting a girlfriend, I've been texting like crazy. I actually know my way around the numpad, and I've gotten pretty fast at texting. This has pulled my attention toward the input method most people use for writing text messages on their phone nowadays, called predictive text.

Every button to on your phone is mapped to multiple characters. This is how you can resolve phone numbers like 1-800-pizza, but they are also used for texting. 2 maps to {'a', 'b', 'c'}, 3 to {'d', 'e', 'g'}, et cetera. In the old, traditional texting method, you would press the 2 key once to get an 'a,' twice for a 'b,' and so on. In predictive text you tap the 2 key only once, no matter which letter you want. The software uses a dictionary of words to see which word your sequence matches to. For example, to get 'you,' you type 968. The dictionary reveals that 'you' is the only word with this combination, and that word is printed to the screen. This is much more efficient than old style texting, since you need to press less buttons to get your word.

Of course, there are inevitable some words that have the same number sequence. For example, 'home,' 'good' and 'gone' all have the sequence 4663. These words are referred to as isotaps. In this case you can select the word you want with the arrow keys. The list is of course ordered by frequency of use.

Isotaps are quite annoying, because they require that you keep looking at the keyboard in case you meet one. So, I was wondering, how many isotaps are there in the english language? Using some python magic I got the answer, along with a few other random statistics. This was ran against the Ubuntu word list, which is usually more expansive than a cell phone one, but it gives an indication. It would be interesting to compare against other languages, to see which languages is most amenable to text prediction (for a better indication, weight isotaps with word frequency)
  • number of isotaps: 14152
  • longest isotap: size(14) 78873322846617 ["putrefaction's", "stupefaction's"]
  • sequence with most isotaps: (length: 12) 22737 ['acres', 'bards', 'barer', 'bares', 'barfs', 'baser', 'bases', 'caper', 'capes', 'cards', 'cares', 'cases']
amount of sequences with x isotaps:
x = 1: 0
x = 2: 4429
x = 3: 980
x = 4: 308
x = 5: 129
x = 6: 39
x = 7: 14
x = 8: 12
x = 9: 3
x = 10: 1
x = 11: 0
x = 12: 1

amount of isotaps of length x:
x = 1: 24
x = 2: 151
x = 3: 645
x = 4: 2134
x = 5: 2937
x = 6: 3389
x = 7: 2603
x = 8: 1366
x = 9: 517
x = 10: 218
x = 11: 81
x = 12: 49
x = 13: 11
x = 14: 5

Note that there are more isotaps of length 14. given is merely an example. The script is available here. I'm afraid I didn't do any fancy graphs, but the data is pretty interesting I think.

This is why I don't like Mines


I'll wait a second while everyone absorbs that screen shot. Just click it and look at it in full size. still waiting... You got it? So yeah, that's a game of Mines (that's minesweeper if you use windows) that I just finished. 99 mines, time is 5:12. That's pretty awesome. Except that I messed up on the last mine. Those who are familiar with Mines will see, though, that the square I picked is equally as valid as the other one. I did not lose due to a logic error, but merely because I was forced to guess.

And that just bothers me. I like Mines because it is a simple logic game that does not take much mind power to solve but does require some thinking. The problem with it is that most of the games I play end up requiring some guessing to finish. This is frustrating. One guess reduces your chances of winning to a mere 5o percent, due to no fault on your part.

Which makes me wonder, is it possible to generate minefields which are ensured to be solvable without guessing? How expensive is that?

Wednesday, 12 November 2008

"happiness is like peeing your pants: everyone can see it, but only you can feel its warmth"

I figured I might as well take another month break from this place. Regular posting schedules are hard, man. I set up Google calendar to e-mail me every day a post is due, but I tend to just ignore the e-mails. I am bad, I know. But I'm out here again today, to praise my laptop.

And my trusty Eee has plenty of reasons to be praised. First, it gets you girls. That is usually not the case with technology, but there's something about a tiny laptop that attracts them like honey attracts bees. Maybe it's the cute factor, I don't know. I will refer you here and stop talking about it now. The second reason to praise my laptop is this: it's got linux on it. And that is cool, because it means that
  • It never crashes
  • You can click the little terminal button and noone will understand what you're doing anymore (including you, sometimes)
  • Most things actually work
  • Things that don't work magically start working some day, making you happy
I should stress that last point a little bit more: Linux makes you happy. It makes you happy because of a nifty thing called a "package manager". If this doesn't make sense, allow me to give you an example of how this works: Say you need to do task X on your computer, but you do not have software to do task X. A little googling reveals you need software Y. In windows, the next steps would be downloading Y from some website, agreeing to a EULA, clicking next a few dozen times, et cetera. On my laptop, you click the little terminal icon (losing all bystanders in the process), and type this:
sudo apt-get -y install Y
and that, my friends, is awesome. Not only does this install and set up the software ready for use, it will download future, newer versions of Y automagically, and set them up without your intervention. And that is why things that don't work suddenly start working someday, making you happy in the process.

what prompted this? Well, this morning I woke up and started my laptop as usual. I had obtained some Linkin Park music the previous day, and wanted to sync this to my iPod. This I do using the Banshee media player. It had sort-of kind-of iPod support, which means it will see your iPod. And after an inordinate amount of time, sometimes it loads some of the songs on it for playing on your pc. And you can drag files to it to upload them. Hopefully. However, today was different. Suddenly, everything worked flawlessly, within seconds. Turns out the trusty package manager had updated Banshee to its new version, 1.4.0, and this version works.

This, my friends, makes me happy.

Today's quote is unsourced. I saw it on bash.org, unsourced. You may have figured out already that I don't know what the source is.

Monday, 24 March 2008

Huge block tower

So, while I was browsing through our archives looking for a passable photo to use in my blogger profile, I came across this gem that my brother and sister built last Christmas.

That is one freakin' huge block tower right there. It's not that clear in the picture, but it goes right up to the ceiling. I asked my sister about the exact length, but she couldn't remember anymore. She did, however, remember that there was only about two centimeters left between the ceiling and the top of the tower. Going by the height of our ceiling, that would make the tower about 2.40 m high!

I never actually saw the real thing, since I was not home that morning. My sister told me it took the entire morning to build, and it never fell down once. The biggest problem was breaking it down without damaging the wooden floor. They eventually just put all the cushions they had around it, and then threw a ball at the bottom. My sister told me it went down like the twin towers.

As an aside, I found a somewhat passable picture for my profile as well, and uploaded that. So go ahead and make jokes about how I look.