Home > Keyboards, Software Release > Easy-to-Use Keyboard Optimization Program

Easy-to-Use Keyboard Optimization Program

I’ve made some modifications to the keyboard optimization program. It is now much easier to use, especially for someone who doesn’t have much experience with computer programming. You can get it here. I added a makefile and a better readme, but more importantly, a command-line user interface. You can now customize the costs, use various features, and even change how the text corpus is weighted.

Advertisements
  1. Atle
    January 25, 2011 at 2:52 pm

    Heh. I cant tell if your program is friendly, since GNU is oh so unfriendly.

    • Got the download from here: mtgap.bilfo.com/Typing.zip
    • Read this README file, to get ‘gcc’ (GNU compiler collection) from this site here: http://gcc.gnu.org/
    • Completely guessing where to navigate, I ended up here: http://gcc.gnu.org/gcc-4.5/
    • Where I assume a ‘mirror site’ is a good place to be, and choosing the US site eventually end up here: http://mirrors-us.seosue.com/gcc/releases/gcc-4.5.2/

    • Now, I guess I dont need any other file except this one: http://mirrors-us.seosue.com/gcc/releases/gcc-4.5.2/gcc-4.5.2.tar.gz

    But Im unsure. Perhaps I need to download more than one of these files?

    Opening this one file … it appears GNU hates Windows and never uses .exe files … so now I have to guess how to install gcc.

    • January 25, 2011 at 10:20 pm

      You’re right, GNU GCC is quite difficult to install. (Fortunately I had it pre-installed.) I don’t use Windows so there’s a limit to what I can do for you, but it looks like you need to install Cygwin before you can install GCC.

      If you already have a C compiler on your computer or you can find one that’s easier to install, you can use that to compile the source code. You just won’t be able to use the makefile so you’ll have to manually install it.

  2. Sam
    January 27, 2011 at 11:52 am

    I’ve downloaded this from mtgap.bilfo.com/Typing.zip and tried to compile it under Ubuntu, but it spits out the errors

    sam@sam-ubuntu:~/Desktop/Typing$ make
    gcc main.c cjalgorithm.c accessories.c algorithm.c fitness.c trifitness.c keyboard.c tools.c trikeys.c costs.c values.c -o optimizer
    cjalgorithm.c: In function ‘run’:
    cjalgorithm.c:51: error: ‘LLONG_MAX’ undeclared (first use in this function)
    cjalgorithm.c:51: error: (Each undeclared identifier is reported only once
    cjalgorithm.c:51: error: for each function it appears in.)
    fitness.c: In function ‘calcParentheses’:
    fitness.c:189: warning: integer constant is too large for ‘long’ type
    make: *** [optimizer] Error 1
    sam@sam-ubuntu:~/Desktop/Typing$ make
    gcc main.c cjalgorithm.c accessories.c algorithm.c fitness.c trifitness.c keyboard.c tools.c trikeys.c costs.c values.c -o optimizer
    cjalgorithm.c: In function ‘run’:
    cjalgorithm.c:51: error: ‘LLONG_MAX’ undeclared (first use in this function)
    cjalgorithm.c:51: error: (Each undeclared identifier is reported only once
    cjalgorithm.c:51: error: for each function it appears in.)
    fitness.c: In function ‘calcParentheses’:
    fitness.c:189: warning: integer constant is too large for ‘long’ type
    make: *** [optimizer] Error 1

    Is this only a problem on my machine or is there a bug hiding somewhere?

    • January 27, 2011 at 1:40 pm

      None of those errors happen on my machine so your compiler must be different.

      error: ‘LLONG_MAX’ undeclared (first use in this function)

      Probably your C standard library does not contain this value. It looks like LLONG_MAX doesn’t exist on all systems. I’ll have to fix that somehow.

      I don’t know about that second error. I’m looking at that line and I don’t see a problem. Perhaps our line numbers are different. Can you paste line 189 of fitness.c into a comment?

  3. Sam
    January 28, 2011 at 12:07 pm

    I just tried to download the program to my work machine, but it seems to be a different version to what I have at home. The link in the blog post is broken so I just pasted in the URL mtgap.bilfo.com/Typing.zip

    The version that downloads doesn’t have any files that have been modified since 14 July 2010, and there’s no makefile. Perhaps I should wait until I have the newest one before trying to compile it again.

    • January 28, 2011 at 1:29 pm

      You’re right, that is not the most recent version. When I download it from mtgap.bilfo.com/Typing.zip it gives the the most recent version so I don’t know what’s going on there. According to my machine, Typing.zip was last modified Jan 27.

      I see why the link is broken. I fixed it.

  4. Sam
    January 28, 2011 at 2:33 pm

    Happy day! I downloaded the link using Firefox instead of Chrome and got the newest one, plus it compiles on this box. I think that Chrome had kept the old file in th cache and just kept duplicating it when I went to download it again.

  5. Atle
    December 30, 2011 at 8:56 am

    I never did get the C to work properly on my computer.

    Is there anyone who can translate this keyboard program into Java?

    I figure an applet can work on almost any system.

    • December 31, 2011 at 5:25 am

      Translating this program into Java manually would require probably at least ten hours of work. You could try compiling it into Java bytecode (a Google search returns this). If that doesn’t work, I plan on converting the program to a web app. It may be a while before I finish, but that will provide a solution in the long term.

  6. Atle
    January 5, 2012 at 10:19 am

    Alas, I tried a program that converts C to Java, but it seems to require C capability to install install properly.

    I cant wait to try your web app.

  7. Atle
    January 5, 2012 at 10:45 am

    Im doing some interesting things with the keyboard layout. Il let you know if any of them prove fruitful. Some of the experiments I can resolve intuitively, but one of them, I need the Keyboard Optimization Program for.

    If you have time, is it possible for you to run this experiment for me?

    For this one, I would like to have ALL of the consonants (including y) on one hand, my righthand. Including removing all the numbers and reusing their spaces for less frequent consonants. (The lefthand will have all the vowels and punctuations.) Then, optimize it, while encouraging inward rolls but discouraging outward rolls.

    I expect it to look similar to the current Fully Optimized layout, except the consonants n, p, and y on the lefthand will somehow squeeze among the rest of the consonants on the righthand.

    Only the righthand consonants require optimization. Its ok to lock the lefthand vowels and punctuation in place, and if necessary, fill in the empty lefthand keys with locked-in numbers.

    • Atle
      January 5, 2012 at 11:00 am

      Just as a visual example. The keyboard experiment would look something like this, albeit more optimal, of course.

      * * * * * * ? V L M Y ? ?
      / , . U “ K D C H W J ? ?
      I O E A : F T S N R Z
      ( ) – ; ‘ B P G X Q

      • January 18, 2012 at 4:32 pm

        I fixed the error.

        /  1  2  3  4  5   6  7  8  9  0  j  q   
           _  -  o  u  (   )  y  l  c  f  k  x  z
           i  n  e  a  .   d  h  t  s  r  b     
           =  "  '  ,  ;   v  p  m  g  w       
        
        Fitness:       19385715
        Distance:      29524
        Finger work:   1104990
        Inward rolls:  10.06%
        Outward rolls: 2.11%
        Same hand:     33.85%
        Same finger:   2.06%
        Row change:    12.82%
        Home jump:     1.08%
        Ring jump:     3.16%
        To center:     1.98%
        To outside:    1.47%
        
    • January 5, 2012 at 3:57 pm

      Right now your mod only works for the full standard layout. It would require a bunch more work to get it to work for Kinesis. I didn’t exactly confine the consonants to the right hand, but I confined them to the keys on the right hand where you put them on the example layout you posted: (c=consonant, *=anything else)

      * * * * * * * c c c c * *
      * * * * * * c c c c c c * *
      * * * * * * c c c c c c
      * * * * * * c c c c c
      

      Here is the optimized layout. It isn’t perfectly optimized, but getting the program to keep working on it would be a lot harder.

      7  8  -  "  :  9   3  1  x  0  2  5  4   
         y  ,  u  g  '   k  p  h  c  m  q  z  6
         i  o  e  a  .   f  t  n  s  r  v     
         (  )  ;  _  /   w  d  l  b  j       
      

      Fitness: 20202210
      Distance: 33959
      Finger work: 798480
      Inward rolls: 4.04%
      Outward rolls: 0.84%
      Same hand: 29.17%
      Same finger: 1.93%
      Row change: 16.35%
      Home jump: 1.41%
      Ring jump: 1.62%
      To center: 2.73%
      To outside: 0.35%

      Edit: I just realized that G is on the left hand. I’ll have to figure out why but I don’t have time right now.

  8. Atle
    January 5, 2012 at 11:48 pm

    I appreciate your running the experiment, and the full standard layout is all I need.

    In the current result, the g showed up on the lefthand, but also the y did. I need to understand how the consonant y falls when it doesnt adjoin the vowel i.

    Even with y and g, the result is exciting.

    • Atle
      January 5, 2012 at 11:58 pm

      By the way, the consonants can be on any key on the righthand, including qwerty-\ and so on. Just in case the program somehow didnt have enough “room” for the y and g.

  9. Patience
    January 16, 2012 at 11:25 pm

    How can you confine certain letters to special positions on the keyboard? For example, if I wanted to optimize the keyboard whose home row was areihtsn, and I set the eight home row keys to be areihtsn by default.

    • January 19, 2012 at 2:06 am

      I’ve made some modifications to make this work, so download the latest version of the program: http://mtgap.bilfo.com/Typing.zip (hmm, maybe I should get a Github account).

      Open up cjalgorithm.c. There are a bunch of arrays called legalBox1, bigLegalBox1, kinesisLegalBox1, etc. Each number indicates a different class of characters. Any two positions with the same number may be swapped, and two positions with different numbers may not be swapped. So to confine the home row on Kinesis, do this:

      int kinesisLegalBox1[] = {
          2, 3, 4, 5, 6, 7, 8, 9,10,11, 1,
          1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
          1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
          12, 12, 12, 12, 1, 1, 12, 12, 12, 12, 1,
          1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
      };
      

      You can see which legal box is used in the isLegalSwap() function, also in cjalgorithm.c. I already created a box that does this for the main-30 keyboard, called legalBox5. So you can change the line legalBox1[i] == legalBox1[j] into legalBox5[i] == legalBox5[j] and it will work for the main-30 keyboard.

      Then you need to set the default layout such that areihtsn lie on the home keys. That takes two changes. First, go into layoutstore.txt and comment out everything. Then go to initKeyboard() in keyboard.c and change the default keyboard (which is given as a string inside the setLayout() function) so that areihtsn are on the home keys. For example, change

      setLayout(k, "qwertyuiopasdfghjkl;zcxvbnm,.'");

      into

      setLayout(k, "bcdfgjklmoarei,.htsn';pquvwxyz");

      Let me know if that works.

  10. Patience
    January 19, 2012 at 9:36 pm

    It works!! Thanks, this is an excellent feature.

  11. Patience
    January 20, 2012 at 1:59 am

    I believe there is a bug in your program. If I let it run long enough (in standard keyboard mode) it will for some reason replace a character by the asterisk (I was at about 17 minutes when this happened).

    / 1 2 3 4 5 6 7 8 9 0 q z
      _ y o u - k d l c w ( ) *
      i n e a . f h t s r x
      ' = " , ; b p m g j
    
    • January 20, 2012 at 3:01 pm

      Yes, I noticed that bug. I have no idea what’s causing it. It happens so rarely that I haven’t figured out how to replicate the results, so it’s really difficult to find the source of the bug. My guess is that there’s some sort of memory leakage.

  12. bogboar
    February 12, 2012 at 2:26 pm

    I figured out how to install the program on my WinXP 32-bit if anyone is interested.

    First, you download MinGW and upon installation include the MSys option (basically a console)
    http://sourceforge.net/projects/mingw/files/

    Then you open up MinGW, navigate into the “Typing” folder, and type “command make”

    Then you can close MinGW and run the executable that just appeared (optimizer.exe).

  13. July 26, 2013 at 12:17 am

    I have read so many content concerning the blogger lovers but this paragraph is
    truly a fastidious post, keep it up.

    • July 27, 2013 at 6:05 pm

      This comment sounds like it was generated by a Markov chain.

  14. Atle
    June 2, 2014 at 10:58 pm

    Hi Michael,

    Was anyone able to get this program to work as an .exe file for Windows?

    • June 3, 2014 at 1:31 am

      Look at bogboar’s comment:

      I figured out how to install the program on my WinXP 32-bit if anyone is interested.

      First, you download MinGW and upon installation include the MSys option (basically a console)
      http://sourceforge.net/projects/mingw/files/

      Then you open up MinGW, navigate into the “Typing” folder, and type “command make”

      Then you can close MinGW and run the executable that just appeared (optimizer.exe).

      • Atle
        June 3, 2014 at 6:39 am

        Unfortunately, the mingw program is extremely unfriendly, and the instructions here are insufficient for those unfamiliar with it.

        Any chance of making an .exe file that already works available for download?

        • June 3, 2014 at 8:45 pm

          I wish I could, but unfortunately I don’t have access to a Windows machine, and probably won’t any time soon.

          • Atle
            June 5, 2014 at 4:51 pm

            Is it possible to get in touch with Bogboar, to get Optimizer.exe from him?

  15. Haldrik
    June 19, 2014 at 6:12 am

    Michael,

    A MinGW user created the Optimizer.exe, usable on Windows. He makes it temporarily available at this site.
    http://qata.de/upload/optimizer.zip

    If you wish, you can make this available on your site for Windows users.

    For Windows, once one decides on the best keyboard layout for yourself, download from Microsoft.com the (easy to use) Microsoft Keyboard Layout Creator 1.4, to make the keyboard use the optimal layout. Perfect for typers who need to use special characters.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: