"MOVA" - Scripts for Work with Dictionary in "MOVA" format

"MOVA" scripts are under the GNU GPL.

"MOVA" scripts use standard UNIX utilities: grep, sed, fmt. Also groff, less are used for console work. These utilities search the plain-text file of the dictionary and place output lines in GUI. Some advantages of this approach are:

  • 1) the ability to search for collocations in the dictionary, ignoring case distinctions in both the dictionary and the input pattern
  • 2) simple updating and debugging of program
  • 3) fast operation. The only major time consumiption results from slow loading of the dictionary file from hard disk into memory and slow graphic interfacing.
  • Important remarks. Pay attention to the size of your RAM: if there is enough memory (for example, 64 MB under the fvwm2), repeated calls of the dictionary are much faster than the first. It's possible for remaining dictionary text in the disk cash memory to become accessible for use if needed (excluding slow copying of the dictionary from the hard disk into memory). If RAM is 32 MB (without hashing), work is impossible (RAM pages are quickly superseded on disk by other programs - thus each new start of a search includes reading the dictionary from the hard disk, resulting in a 1-2 second delay. Moreover, if swapping begins to work waiting time becomes much more).,

    Now MOVA uses hashing (or indexing) for the first two letters of word entries. This mechanism works for searching with "-W"/"-B" options. The name of the hashing file consists of the name of the dictionary used, and ".hash" at the end. The advantage of these trick comes from more rapid loading in RAM of a file or of part of a file.

    Searching and formatting of lines is mainly performed by bash script mova. To the command line of the script may be added options for searching for a word or sequence of words. Depending on the options given in the command line it will search for a word from the beginning of the dictionary entries (option "-W"), the first part of the word from the beginning of the dictionary entries (option "-B"), the sequence of words inside the dictionary entries (option "-S", it is possible to use as in a Russian-English dictionary), the sequence of symbols (including blanks) in the dictionary (option "-T"). Then, the found lines are passed through the sed filter, which adds to each entry an empty line and formats variants of the meaning of the word. You may use mova in consol with analogous options (-w, -b, -s, -t). In this case it will be added groff and less filters to the script output. See screenshot
    .

    Usually, mova isn't used independently, and is called in XWindows from Tcl/Tk scripts - movaTK, see screenshot

    movaMTK uses another method of output of information on GUI (it's more convenient if necessary to leave translated earlier words on the screen, though usually search works more slowly). See screenshot

    Tcl/Tk scripts paint in red the phonetic transcription symbols and substitute the IPA font in square brackets. All English words appear in blue. Searched words or symbols are marked in blue. The functional label is marked by italic font and green colour (and bold font for grammatic designation). A word entry before two blank symbols is substituted with FONT_FIND font (besides, this font is used in the text entry in the upper yellow strip and for marking words in the grey window of your searching history).

    Exit from movaTK and movaMTK is "Esc"-button.

    There are square buttons upper and under scrollbar for searching in output entry.

    For work with "MOVA" scripts, a word or text blocked out with the "mouse" (the space symbols do not interfere with the scripts). Then from xterm or by built-in button (for "fvwm2" edit the file .fvwm2rc in home directory) is started the respective Tcl/Tk script. For example:

    DestroyMenu "Utilities"
    AddToMenu "[email protected]@^white^"
    + "Mueller7%mova_32x22.xpm%" Exec movaTK -W Mueller7GPL.koi &
    + "Mueller7 M%mova_32x32.xpm%" Exec movaMTK -W Mueller7GPL.koi &

    You may use scripts without a mouse. Input a word/string by hand in the yellow field. Searching with option "-W" will start with the "Enter" key; "-B" - "Shift-Enter"; "-S" - "Ctrl-Enter"; and "-T" - "Alt-Enter".

    One more important manager script is: mova_sendTK. By using this script it is possible to send request for a translation in already open windows of "MOVA" (with various dictionaries). If an open window movaTK with Mueller7GPL.koi is not present, a new movaTK with Mueller7GPL.koi will be started. It is necessary to use command line options similar to movaTK and mova. If you want to have an opportunity for starting a search in the dictionary from any program on your desktop with keyboard shortcuts, add in yours .fvwm2rc lines:
    #Keys for Mueller's dictionary
    Key z A M Exec mova_sendTK -W &
    Key � A M Exec mova_sendTK -W &
    Key x A M Exec mova_sendTK -B &
    Key � A M Exec mova_sendTK -B &
    Key a A M Exec mova_sendTK -S &
    Key � A M Exec mova_sendTK -S &
    Key s A M Exec mova_sendTK -T &
    Key � A M Exec mova_sendTK -T &

    After restarting the X-server you have an opportunity to search for blocked-out words in movaTK by pressing Alt-a (for search with an option -S), Alt-s (for search with an option -T), Alt-z (for search with an option -W), Alt-x (for search with an option -B). If the keyboard is in the koi8-r keyboard map, the appropriate keys will work also. Besides, these keys with Alt will work someplace in the GUI and from windows of the majority of programs.

    Sometimes, "wish" does not want to send data into an already open program on the GUI and says, that you have problems with privacy. Try to execute:
    xauth add :0 . `mcookie`
    And then add in ".xserverrc"
    exec X :0 -bpp 16 -auth ~/.Xauthority
    and restart X-server

    Dictionaries, scripts, tuning files and README placed according to FHS (File Hierarchy Standard) - in /share/dict/, /share/mova/, /share/doc/mova/. There is point of bind these directories (it is DIR=/usr/local/ in script body). You may change this "point of bind" in tuning files - .movarc ��� .movarc_DICTIONARY in home directory or in DIR/share/mova/ or in body of script (in absence of tuning files). For installation of "MOVA", copy the compressed file in the root directory "/" and execute the commands:
    tar -xzf Mueller7GPL.tgz
    tar -xzf script_mova.tgz

    If you want to see a phonetic transcription, it is necessary to register Sil-IPA fonts in XF86Config:
    FontPath "/usr/X11R6/lib/fonts/sil_ipa/"
    FontPath "/usr/X11R6/lib/fonts/misc/"
    FontPath "/usr/X11R6/lib/fonts/75dpi/:unscaled"
    FontPath "/usr/X11R6/lib/fonts/100dpi/:unscaled"
    The original site (http://www.sil.org/computing/fonts/encore-ipa.html) Sil-IPA fonts has a set of TrueType fonts. These fonts are distributed under special Free license and it's necessary to contact authors for commercial usage.

    Setups of fonts and current dictionaries set in the beginning of Tcl/Tk scripts: in "movaTK" and "movaMTK":
    set FONT_FIND -*-*-bold-r-*-*-17-*-*-*-*-*-koi8-r
    set FONT_TEXT -*-*-medium-r-*-*-17-*-*-*-*-*-koi8-r
    set FONT_D -*-*-medium-o-*-*-17-*-*-*-*-*-koi8-r
    set FONT_DG -*-*-bold-o-*-*-17-*-*-*-*-*-koi8-r
    set FONT_IPA -*-silsophiaipa-*-r-*-17-*-*-*-*-*-*-*
    set DIR /usr/local/
    set DIR_TMP /tmp/
    set DIC Mueller7GPL.koi
    You may use ".movarc" in user's home directory for total dictionary setup. If you run mova or movaMTK/movaTK without the dictionary name in the command line, the default dictionary --- from DIC will be used . For example, such ".movarc":
    -*-*-bold-r-*-*-20-*-*-*-*-*-*-koi8-r
    -*-*-medium-r-*-*-20-*-*-*-*-*-koi8-r
    -*-*-medium-o-*-*-20-*-*-*-*-*-koi8-r
    -*-*-bold-o-*-*-21-*-*-*-*-*-koi8-r
    -*-silsophiaipa-*-r-*-20-*-*-*-p-*-*-*
    /usr/local/
    /tmp/
    Mueller7GPL.koi

    You may use ".movarc_DICTIONARY" (where DICTIONARY is the file name of the dictionary) for individual dictionary setup. For using simple European dictionaries (without comment and example, only some word and its translation to Russian) substitute appropriate fonts for FONT_FIND and FONT_TEXT. For example, such ".movarc_DICT":
    -*-*-bold-r-*-*-20-*-*-*-*-*-*-1
    -*-*-medium-r-*-*-20-*-*-*-*-*-koi8-r
    -*-*-medium-o-*-*-20-*-*-*-*-*-koi8-r
    -*-*-bold-o-*-*-21-*-*-*-*-*-koi8-r
    -*-silsophiaipa-*-r-*-20-*-*-*-p-*-*-*
    /usr/local/
    /tmp/

    You can see some buttons in the upper blue line:
    Help - flashes short Russian help.
    Dictionary - choose work dictionary from menu. Open the menu with mouse or Alt-d from keyboard.
    New Diary - a word blocked out by mouse becomes the name of a current Diary file.
    Add to Diary - adds the content of the text window to the end of the current Diary file.
    Rewrite Diary - save content of the text window to current Diary file in home catalog (this is .mova by default). Preceding content of Diary file will be lost.
    Read Diary - choose work Diary from menu. Open the menu with mouse or Alt-r from keyboard.

    You can see icons for MOVA in DIR/share/mova/icons/. Put them in the corresponded directory for you windows manager. mova_22x15.xpm; mova_32_22.xpm; mova_48x32 - for one-windowed MOVA, and mova_22x22.xpm; mova_32_32.xpm; mova_48x48 - for multi-windowed MOVA. See screenshot

    You may download last version (ver. 4.0) of scripts from www.chat.ru/~mueller_dic/script_mova.tgz or www.geocities.com/mueller_dic/script_mova.tgz.

    20.7.99 Dmitry Mishchenko warns of FreeBSD users, that "fmt" has different options. You must change into "mova" file: "fmt -s -w 45" on "fmt 45".

    6.10.99 Igor Gots offers to save to some special log file all translated words in any given day. To that end, change in mova file the follow line:
    &/g'|fmt -s -w 45;}
    on
    &/g'|fmt -s -w 45|tee -a /tmp/Mueller.`date|sed 's/[ ].*//g'`.log;}
    Don't forget to delete old logs every week :-)

    Please, send notes and suggestions to Eugene Cymbalyuk by e-mail: [email protected].

    Hosted by www.Geocities.ws

    1