-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Attached is an Emacs program for vocabulary drilling. I wrote it quite some
time ago and planned to release back then but got distracted. Well, better
is late than never.
The program uses simple text files with colon-separated values as
dictionaries.
Enjoy,
==
;; $Id: voctest.el 1643 2005-05-26 03:13:36Z abel $
;; voctest.el - an Emacs vocabulary test program
;; Author: Alexander L. Belikoff (alexander @ belikoff . net)
;; Version: 2.0 ($Revision: 1643 $)
;; Keywords: dictionary, vocabulary, test
;; URL: http://www.belikoff.net/software/voctest.el
;; Copyright (C) 1997-2005 Alexander L. Belikoff
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, write to the Free Software
;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
;; Commentary:
;; Voctest allows you to test your vocabulary, based on a dictionary.
;; It displays a word and a number of translations, where only one of
;; them is correct. User responds by pressing a number, corresponding
;; to the "right" translation. If a user presses 'q' (case doesn't matter)
;; the program quits.
;; The following goodies are supported:
;; 'c' - toggle automatic display of the correct answer if the user
;; makes a mistake (default: OFF)
;; '?' - give a quick hint for a number of seconds, defined by the value
;; of the `voctest-hint-time' variable. After a hint, the answer
;; is not counted.
;; The program is not restricted to translations only. The structure of the
;; dictionary file allows you to use other things - for example to test
;; your knowledge of words' gender in French or German, or the way
;; to write a word in Kanji, based on it's Hiragana spelling (well, I'm
;; not sure the latter will work, since the Japanese codeset may use ':')
;; Moreover, in the future multi-field dictionaries will be supported,
;; thus allowing various types of testing for the same dictionary.
;; The number of choices displayed is defined by the `voctest-num-choices'
;; variable. It must be in the [2..9] region.
;; The function to start is 'voctest'. You will be prompted for a
;; dictionary file to use. By default, the file is looked in the directory,
;; specified by a `voctest-dictionary-directory' variable. The default file
;; is specified by the `voctest-default-file' variable.
;; The dictionary in the file consists of entries. Each entry occupies
;; a line and has the following structure:
;;
;; field1 : field2 : ... : fieldN
;;
;; for example `field1' may be a word, `field2' - it's article, `field3/ -
;; it's translation in Russian, and `field4' - translation in Hebrew.
;; Spaces and tabs don't matter.
;; The test direction is specified by the `voctest-test-direction' variable.
;; It is a pair of numbers, where the first one is the field number to use
;; (starting with 0) for words in questions, and the second one - the field
;; number to fetch the answer choices. The NIL symbol instead of number will
;; make voctest fetch the last entry in the article
;; For highlighting, the following faces are defined:
;; voctest-question-face - for the word in question
;; voctest-answer-face - for the answer choices
;; voctest-right-count-face - for the `Right' count
;; voctest-wrong-count-face - for the `Wrong' count
(defvar voctest-version "2.0 ($Revision: 1643 $)"
"VOCTEST version")
(defvar voctest-dictionary-directory "~/lib/dic/"
"Directory where to look for the dictionaries")
(defvar voctest-default-file "DEFAULT.dic"
"Default dictionary file")
(defvar voctest-num-choices 5
"Number of answer choices - must be in [2..9]")
(defvar voctest-test-direction '(0 . nil)
"Test direction - a pair of two numbers.
The first number is an element index in the dictionary article to use for
the word to test. The second number is used to fetch the answers")
(defvar voctest-hint-time 2
"Number of seconds to display hint for")
;
;; requirements
;; mode-specific tables
(defvar voctest-mode-syntax-table nil
"Syntax table used while in voctest mode.")
(cond ((not voctest-mode-syntax-table)
(setq voctest-mode-syntax-table (make-syntax-table))
(modify-syntax-entry ?\" ". " voctest-mode-syntax-table)
(modify-syntax-entry ?\\ ". " vo