NAME

Text::TypingEffort - calculate the effort required to type a given text

SYNOPSIS

use Text::TypingEffort qw/effort/;

my $effort = effort("The quick brown fox jumps over the lazy dog");

$effort will be a hashref something like this

$effort = {
    characters => 43,     # the number of characters in the text
    presses    => 44,     # key presses need to type the text
    distance   => 950,    # millimeters the fingers moved while typing
    energy     => 2.2..., # the energy (Joules) used while typing
};

DESCRIPTION

Text::TypingEffort is used to calculate how much physical effort was required to type a given text. Several metrics of effort are used. These metrics are described in detail in the "METRICS" section.

This module is useful for determining which keyboard layout is more efficient, for making API/language design decisions, or to show your boss how hard you're working.

FUNCTIONS

effort $TEXT | \$TEXT

The parameter should be a scalar or a reference to a scalar which contains the text to be analyzed. Leading whitespace on each line of $TEXT is ignored since a decent text editor handles that for the typist. Only characters found on a standard US-104 keyboard are tallied in the metrics. That means that accented characters, unicode, etc. are not included. If a character is unrecognized, it will be silently ignored.

effort %PARAMETERS

effort() may also be called with a list of named parameters. This allows more flexibility in how the metrics are calculated. Below is a list of acceptable (or required) parameters.

text
file

One of these two options must be specified. If neither is specified, effort() will die. The value of text should be a scalar or reference to a scalar containing the text to analyze. The value of file should be a filehandle which is open for reading or a file name.

layout

Default: qwerty

This parameter specifies the keyboard layout to use when calculating metrics. The value of layout should be either 'qwerty' or 'dvorak'. If a value different from those is specified, the default value of 'qwerty' is used.

Calling effort like: effort($text) is identical to calling it like this

effort(
   text   => $text,
   layout => 'qwerty',
);

METRICS

characters

The number of recognized characters in the text. This is similar in spirit to the Unix command wc -c. Only those characters which are encoded in the internal keyboard layout will be counted. That excludes accented characters, Unicode characters and control characters but includes newlines.

presses

The number of keys pressed when typing the text. The value of this metric is the value of the characters metric plus the number of times the Shift key was pressed.

distance

The distance, in millimeters, that the fingers travelled while typing the text. This distance includes movement required for the Shift and Enter keys, but does not include the vertical movement the finger makes as the key descends during a press. Perhaps a better name for this metric would be horizontal_distance, but that's too long ;-)

The model for determining this metric is very simplistic. It assumes that a finger moves from its home position to the destination key and then returns to the home position before moving on to the next key. Of course, this is not how people actually type, but the model should result in an upper-bound for the amount of finger movement.

energy

The number of Joules of energy required to type the text. This metric is the most inclusive in that it tries to accomodate the values of both the presses and the distance metrics into a single metric. However, this metric is also the least accurate at modeling the real world. The calculations are roughly based upon the The Compendium of Physical Activities (or rather hearsay about it's contents since I don't have a copy).

The physical charactersistics of the keyboard are assumed to be roughly in line with ISO 9241-4:1998, which specifies standards for such things.

SEE ALSO

Tactus Keyboard article on the mechanics and standards of keyboard design - http://www.tactuskeyboard.com/keymech.htm

AUTHOR

Michael Hendricks, <michael@palmcluster.org>

TODO

  • Add an 'accumulator' option which allows effort() to add it's results to those from a previous call to effort().

  • Count the unrecognized characters

  • Add support for the 'aset' keyboard which is like QWERTY, but has the dfjk keys swapped with the etni keys.

  • Allow the user to specify custom keyboard layouts

  • Allow keyboards other than US-104

  • Add options for specifying the characteristics of the keyboard such as key displacement and the force required to depress the keys.

COPYRIGHT AND LICENSE

Copyright (C) 2005 by Michael Hendricks

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.4 or, at your option, any later version of Perl 5 you may have available.