next up previous contents
Next: Creating Cache Files Up: Word Completion Previous: Word Completion Options   Contents

Word Completion Cache Files

Word completion in GTKeyboard uses a special cache file that guides GTKeyboard in suggesting which word may be the most useful to insert given a particular set of characters. For example, when you type the letter ``c'', how does GTKeyboard know whether you're thinking of the word ``cache'', ``communist'', ``catchy'', ``cantankerous'', or any of the other hundreds of words that start with ``c''?

Well, frankly, it doesn't. But it can take a good guess. This is what cache files are for. A cache file specifies a list of words with their frequencies. For example, in a text file about Darwin and Evolution, the term ``evolution'' or the term ``species'' may be quite common. The common terms are the terms that we want to appear first in the completion list given the beginning of the word. The frequency of different words provided by the cache file fits this role perfectly.

The default user cache file is located at /.gtkeyboard-wordcache. It will contain a list of an arbitrary number of words with their frequencies in a given document. Although the file is not meant to be edited by hand, its general form looks like this:

5 above
1 absence
2 accept
1 acceptance
2 access
1 accompanies
1 accord
1 achieve
2 act
1 actions
2 add
1 addition
Simply a number corresponding to the number of times the word occured in the document followed by the word itself. (The word ``above'' occurred 5 times, but the word ``acceptance'' occured only once) If this cache file were used in GTKeyboard, and the character ``a'' were typed, GTKeyboard would suggest 10 completions, from the most often occuring to the least often occuring. The way the words are ranked is by the frequency number found in the cache file.

When a new completion window is created, GTKeyboard will always load /.gtkeyboard-wordcache if it exists. If it doesn't, then GTKeyboard has to do the best it can, and usually loads the dictionary file. (This file is often located at /usr/dict/words on may GNU/Linux systems). While the dictionary file is not optimal, it still produces decent results depending on the application.

To load a new cache file into GTKeyboard's word completion facility, click on the ``Load Cache File'' button in the main word completion window. It will present you with a file chooser dialog. Once you hit ``OK'', the new cache file will be loaded in.

Users may find it interesting to have different cache files for different tasks to speed up the task at hand. For general text editing that doesn't really have a particularly well defined domain, using no cache file, (letting GTKeyboard use only /usr/dict/words) is usually best. For specialized tasks, such as Perl or HTML programming with GTKeyboard, a specialized cache the word ``print'' over the word ``perfect'' would be very helpful, since ``print'' is the name of a built in Perl function, and ``perfect'' isn't, even though it would occur more often than ``print'' if the document were a general text document.


next up previous contents
Next: Creating Cache Files Up: Word Completion Previous: Word Completion Options   Contents
David Allen 2001-04-26