Mercurial > freewnn
view cWnn/manual.en/chap5 @ 29:35bc1f2e3f14 default tip
minor fix
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Sat, 06 Mar 2010 23:55:24 +0900 |
parents | bbc77ca4def5 |
children |
line wrap: on
line source
************************************************* * Chapter 5 ENVIRONMENT SETUP * ************************************************* 5.1 OVERVIEW ============= All the user environment and operating environment in cWnn are defined in the system environment files. The setup of environment includes the following : 1. cserverrc -- The initialization file for the server. 2. uumrc -- The initialization files for the front-end processor uum. 3. wnnenvrc -- The environment setup files for conversions 4. wnnenvrc_R -- The environment setup files for reverse conversions. 5. uumkey -- The keyboard layout definition file for the front-end client. 6. cvt_key_tbl -- The file which defines the keyboard input conversion. - 5-1 - 5.2 cserverrc - THE INITIALIZATION FILE OF THE SERVER ====================================================== * Description cserverrc - Server initialization file * Standard path /usr/local/lib/wnn/zh_CN/cserverrc * Function During the startup of cserver, cserverrc is read as well as all the files defined in cserverrc (dictionaries and grammar files). * Definition 1. Dictionaries that are read during the startup of cserver - Format readfile <wnn_file> Read in wnn_file. All dictionaries and grammar files (refer Chapter 7 for details) are read in during cserver startup and maintained until the termination of cserver. 2. Maximum client allowed - Format max_client n This is the maximum number of clients (users) that are allowed to be connected at any one time. Default value is 32. 3. Maximum environment - Format max_sticky_env n This is the maximum number of permanent environment allowed. A permanent environment remains in the server after the termination of the front-end uum. This helps in reducing the startup time of each client and repeated operations. Default value is 10. 4. Path of dictionaries that are maintained by the server. - Format jserverdir <path> This defines the path of dictionaries maintained by the server. Usage frequency files and dictionaries of the user are also maintained here. The default path is "/usr/local/lib/wnn/zh_CN/". - 5-2 - 5. The default parameters for Pinyin-Hanzi conversions. - Format def_param <parameter 0> <parameter 1> <parameter 2> <parameter 3> <parameter 4> <parameter 5> <parameter 6> <parameter 7> <parameter 8> <parameter 9> <parameter 10> <parameter 11> <parameter 12> <parameter 13> <parameter 14> <parameter 15> <parameter 16> All parameters are integers. During conversion, server will perform the conversion evaluation based on these parameter values. <parameter 0> : number of phrase "n" to be assesed <parameter 1> : number of words "m" in phrase <parameter 2> : usage frequency weight <parameter 3> : word length weight <parameter 4> : tone correctness weight <parameter 5> : last used weight <parameter 6> : dictionary priority weight <parameter 7> : average word assessment value weight <parameter 8> : phrase length weight <parameter 9> : number of words in phrase weight <parameter 10> : usage frequency of numerals <parameter 11> : usage frequency of alphabets <parameter 12> : usage frequency of symbols <parameter 13> : usage frequency of open parentheses <parameter 14> : usage frequency of close parentheses <parameter 15> : not used <parameter 16> : not used The following are the default values : 1 3 5 50 10 20 10 40 1200 200 0 0 0 0 0 0 0 6. Definition or Xuni (quasi) grammatical category for alphabets - Format set_giji_ascii <char> Alphabets, numerals and some defined characters can be classified as Xuni type in the Pinyin-Hanzi conversions and vice versa. <char> can be represented in hexadecimal, decimal, octal as well as enclosed between single quotations. - 5-3 - 5.3 uumrc - THE INITIALIZATION FILE OF THE CLIENT (uum) ========================================================== * Description uumrc - Client (cuum) initialization file. * Standard paths /usr/local/lib/wnn/zh_CN/uumrc * Function Initialization file for the startup of the client. - Set the path of each of the environment setup files, the keyboard layout file etc. - Set the initial state after startup of client. - Set the different conversion parameters. * Content - include > Format include <path> Read in all the initialization files defined in <path>. Used when user needs to add his own definitions. - setenv > Format setenv <env_type> <path> [sticky] setenv <env_type> <host> <path> [sticky] > Standard Path /usr/local/lib/wnn/zh_CN/ To define the conversion environment based on the environment definition files indicated in <path>. If <host> is given, the environment will be created on the server of the specified hostname. Similarly, the server will be that of the specified host. [sticky] implies a permanent environment. <env_type> indicates the environment type. The types include Pinyin/Zhuyin input and the Bianma input environment. Pinyin/Zhuyin input environment is represented by "PZ". The Bianma input environment corresponds to respective input method name. - 5-4 - - setenv_R > Format setenv_R <env_type> <path> [sticky] setenv_R <env_type> <host> <path> [sticky] > Standard Path /usr/local/lib/wnn/zh_CN/ Simliar to "setenv" above. The only difference is that "setconvenv_R" is for reverse conversion. For example, Pinyin-Hanzi conversion will be Hanzi-Pinyin conversion, and Bianma-Hanzi becomes Hanzi-Bianma conversion. - setuumkey > Format setuumkey <path> > Standard Path /usr/local/lib/wnn/zh_CN/uumkey Set <path> as the keyboard function definition file of the client. (For details, refer to Section 5.6) - setrkfile > Format setrkfile <path> > Standard Path /usr/local/lib/wnn/zh_CN/rk_p/mode -- for Pinyin /usr/local/lib/wnn/zh_CN/rk_z/mode -- for Zhuyin /usr/local/lib/wnn/zh_CN/rk/mode -- for combination of both Indicates the input mode definition files. If <path> is a directory, the file "mode" under this directory will be read. - setconvkey > Format setconvkey [<tty>] <path> > Standard Path /usr/local/lib/wnn/cvt_key_tbl To enable the change of functions for the keyboard keys to suit that of cuum. The terminal name must correspond to that defined in the environment variable TERM, or else the definitions will be invalid. "*" can be used for the terminal name. - 5-5 - - setdicpath > Format setdicpath <path> > Standard Path /usr/local/lib/wnn/zh_CN/dic/sys/ Set the path of the dictionary files when adding dictionaries to the system. Default path is NULL. - sethindopath > Format sethindopath <path> > Standard Path /usr/local/lib/wnn/zh_CN/dic/usr/@HOME/ Set the path of the usage frequency files when adding dictionaries to the system. Default path is NULL. - setfuzokugopath > Format setfuzokugopath <path> > Standard Path /usr/local/lib/wnn/zh_CN/dic/sys Set the path of the grammar files when adding dictionaries to the system. Default path is NULL. - not_send_ascii_char When the input line is empty, ASCII characters will be sent to the conversion buffer (default). - send_ascii_char When the input line is empty, ASCII characters will not be sent to the conversion buffer. - waking_up_in_henkan_mode To set the conversion mode to ON after the startup of the client. - waking_up_no_henkan_mode To set the conversion mode to OFF after the startup of the client. - setmaxchg <number> Indicates the maximum number of characters allowed for conversion at one time. Default number is 80. - setmaxbunsetsu <number> Indicates the maximum number of words allowed for conversion at one time. The maximum value is 400 and default is 80. - 5-6 - - setmaxichirankosu <number> Indicates the number of candidates to be displayed at one time. This will depend on the width of the screen. Default number is 36. - setmaxhistory <number> Indicates the maximum number of entries for the conversion history. Default value is 11. - excellent_delete During Pinyin-Hanzi conversion, the input automaton converts the input to standard Pinyin, and remembers the most recent Pinyin. When "backspace" key is used to delete the current input, the last standard pinyin will be converted back to the original input string so as to enable the user to make corrections. In other cases, the entire Pinyin is deleted as a single character. - simple_delete Once the input string is mapped to its corresponding standard Pinyin, the standard Pinyin will be deleted as a single character. - flow_control_on To set the flow control of tty to ON (default). - flow_control_off To set the flow control of tty to OFF. - convkey_not_always_on When the input mode is set to OFF, all related conversion function keys are invalid (default). - convkey_always_on When the input mode is set to ON, all related conversion function keys are still valid. - remove_cs To remove cs from termcap. - not_remove_cs Do not remove cs from termcap. - touroku_comment During the addition of a new word, comments can be input. - touroku_no_comment During the addition of a new word, comments cannot be input. - 5-7 - * During path definition, the following abbreviations can be used : (1) - The value of environment variable HOME . (2) usrname The home directory for the user in "/etc/passwd". (3) @HOME The value of environment variable HOME . (4) @LIBDIR The path "/usr/local/lib/wnn". * Example (definition of uum) setconvenv PZ /usr/local/lib/wnn/zh_CN/wnnenvrc setconvenv_R PZ /usr/local/lib/wnn/zh_CN/wnnenvrc_R setuumkey @LIBDIR/zh_CN/uumkey setrkfile @LIBDIR/zh_CN/rk setconvkey @LIBDIR/cvt_key_tbl setconvkey ST* @LIBDIR/cvt_key_tbl.ST setconvkey kterm* @LIBDIR/cvt_key_tbl.kt setmaxhistory 20 waking_up_no_convert_mode ;waking_up_no_henkan_mode flow_control_on admin_comment ;touroku_comment not_send_ascii_char * Note During startup of client, files such as dictionaries, grammar files and usage frequency files will be read in by the server if they have not been read in during cserver startup. If they do not exist, server will create a new file. * Reference cuum(4.3) cserver(4.2) sys_dic (7.3) usr_dic (7.3) - 5-8 - 5.4 wnnenvrc - ENVIRONMENT INITIALIZATION =========================================== * Description wnnenvrc - Initialzation file for Hanzi conversion environment * Standard path (1) The corresponding file defined in uumrc (2) /usr/local/lib/wnn/zh_CN/wnnenvrc * Function Defines the conversion environment for the user. This file is defined in uumrc. When the file is redefined, the latest version will be valid. * Content - include <wnnenvrc filename> To read in other wnnenvrc files. - setdic <p1> <p2> <p3> <p4> <p5> <p6> <p7> <p8> To set a dictionary for the current environment. "setdic" command can be used to define several dictionaries for the same environment. <p1> <filename> -- Set the dictionary filename. <p2> <filename> -- Set the usage frequency filename of the specified dictionary. -- <p2> can be represented by "-" as default. By default, usage frequency defined in the dictionary will be used. -- When defining usage frequency file <p2>, it must correspond to the file in <p1>. <p3> <n> -- Set the priority of the dictionary. It is represented in decimal <p4> <0/1> -- 1: dictionary is read only 0: dictionary can be updated <p5> <0/1> -- 1: usage frequency file is read only 0: usage frequency file can be updated <p6> <filename> -- Set the password filename of the dictionary. -- <p6> can be represented by "-" as default. <p7> <filename> -- Set the password filename of the usage frequency file. -- <p7> can be represented by "-" as default. <p8> <0/1> -- 1: Forward -- 0: Reverse Example : setdic basic.dic - 5 0 0 - - 0 - 5-9 - - setfuzokugo <file_name> Set the grammar file. - setparam <c0> <c1> <c2> <c3> <c4> <c5> <c6> <c7> <c8> <c9> <c10> <c11> <c12> <c13> <c14> <c15> <c16> Set the parameter values for Pinyin-Hanzi conversion. (refer to 5.2) The parameters should be integers. During conversion, the server uses these parameter values to determine the conversion result. By default, the system uses the values defined by "def_param" in the cserver. - confirm When the usage frequency files set in "setdic" do not exist, the system confirms with the user on whether he wants to create each individual new usage frequency file. - confirm1 When the usage frequency files set in "setdic" do not exist, the system only confirm once with the user to create all the new usage frequency files. - create_without_confirm When the usage frequency files set in "setdic" do not exist, new usage frequency files will be created automatically. - no_create When the usage frequency files set in "setdic" do not exist, new usage frequency file will not be created automatically. * Example confirm1 setdic sys/level_1.dic usr/@USR/level_1.h 4 1 0 - - 0 setdic sys/level_2.dic usr/@USR/level_2.h 1 1 0 - - 0 setdic sys/basic.dic usr/@USR/basic.h 7 1 0 - - 0 setdic usr/@USR/ud - 5 0 0 - - 0 setfuzokugo sys/full.con def_param 1 8 5 50 10 20 10 40 1200 200 0 0 0 0 0 16 0 * Note During path definition, the following abbreviations can be used. (1) - The value of environment variable HOME (2) -username The home directory of the username defined in /etc/passwd. (3) @HOME The value of environment variable HOME (4) @LIBDIR The path /usr/local/lib/wnn (5) @USR The value of environment variable LOGNAME - 5-10 - 5.5 wnnenvrc_R - INITIALIZATION FILE FOR REVERSE CONVERSION ENVIRONMENT =========================================================================== * Description wnnenvrc_R - The initialization file of reverse conversion environment. * Standard path (1) The corresponding file defined in uumrc (2) /usr/local/lib/wnn/zh_CN/wnnenvrc_R * Function Defines the reverse conversion environment for the user. This file is defined in "uumrc". When the file is redefined, the latest version will be valid. * Content Similar to "wnnenvrc". For details, please refer to Section 5.4. * Example confirm1 setdic sys/level_1.dic usr/@USR/level_1.h 4 1 0 - - 1 setdic sys/level_2.dic usr/@USR/level_2.h 1 1 0 - - 1 setdic sys/basic.dic usr/@USR/basic.h 7 1 0 - - 1 setdic usr/@USR/ud - 5 0 0 - - 1 setfuzokugo sys/full.conR setparam 1 8 5 50 10 20 10 40 1200 200 0 0 0 0 0 16 0 The value of the 8th parameter is "1". This implies that the dictionary is used for reverse conversion. - 5-11 - 5.6 uumkey - THE KEYBOARD DEFINITION FILE FOR THE CLIENT ========================================================== * Description uumkey - The keyboard definition file for the client * Standard path /usr/local/lib/wnn/zh_CN/uumkey * Function uumkey is the definition file for the keyboard layout during conversion. The relationship between an input key and its command defined in the uumkey file. User can define the function of a particular key according to his needs. Lines that begin with ":" or ";" are treated as comments. * Content - include <uumkey filename> Read in other keyboard definition files. - command <key> [ <key> ....] Definition of function keys: <key> can be represented in decimal, hexadecimal, octal or character enclosed between single quotes. There are 11 states for the front-end processor. (Refer to State Table) - unset <command> To remove all the function key definitions which correspond to <command>. - 5-12 - State Table +-------------------------------------------------------------------------------+ | State Number | Description | |---------------+---------------------------------------------------------------| | 0 | The state of performing correction on the conversion result | | 1 | The state before conversion, ie. the input state. | | 2 | The state when segmentation is done to the words and phrases | | | after conversion. | | 3 | The initial state when the input buffer is empty. | | 4 | The state of cursor movement for the selection of candidates | | | for a Chinese character. (including the selection of phrase | | | candidates, performing certain operations, and selection of | | | grammatical category and dictionary when adding words. | | 5 | The state that specifies the range of characters to be added | | | as a new word. | | 6 | The input state for Pinyin during the addition of new words | | | to dictionary | | 7 | The state for searching/deleting word or dictionary | | 8 | The inspect state; search for a word and retrieve information | | | of the word. | | 9 | The state for dictionary search. | | A | The inspect state. | +-------------------------------------------------------------------------------+ * Command format The following shows the relationship between the function keys and their states. (1) Format-1: command name function description (2) Format-2: command name state number: function description state number: function description .... .... * Command description - convert_on 0123456789 To set conversion state to ON or OFF. - quote_keyin 0123456789 To quote the next input character so that function keys used for setting conversion state can also be used for input. This function is used for special cases when input of "convert_on" function key code is needed. - send_string 012 To send the conversion characters together with the corresponding function code to application procedure. - 5-13 - - definite 012 (Confirm) To send the conversion character string to application procedure. - forward_char 01256 156: To move the cursor one character position to the right 0 : To move the cursor one word to the right 2 : To remain the cursor position as ASCII, perform multi-phrase conversion for the character after the cursor, and move the cursor one word to the right. - backward_char 01256 1 : To move the cursor one character position to the left. If this function is used when the cursor is at the leftmost position of the unconverted portion or a partially converted string, multi-phrase conversion will be performed and the cursor will move one word to the left. 56 : To move the cursor one character to the left. 0 : To move the cursor one word to the left. 2 : The highlighted portion will remain as ASCII, the portion beyond the highlighted part will undergo multi-phrase conversion, and the cursor will move one word to the left. - goto_top_of_line 01256 1256: To move the cursor to the first character of the line. 0 : To move the cursor to the first word of the line. - goto_end_of_line 01256 1256: To move the cursor to the last character of the line. 0 : To move the cursor to the last word of the line. - delete_char_at_cursor 156 To remove the character at the position of the cursor. - kaijo 02 To change the converted character strings after the cursor back to that before the conversion. - henkan 1 To perform multi-phrase conversion. - tan_henkan 1 To perform conversion for a single word. - tan_henkan_dai 1 To perform conversion for a phrase. - 5-14 - - nobi_henka 2 During word elongation, the highlighted portion will be converted as a word and the remaining portion will undergo multi-phrase conversion. - nobi_henka_dai 2 During compulsory word segmentation, the portion before the cursor will be converted to a phrase, and the portion after the cursor will undergo multi-phrase conversion. - jikouho 0 To extract the next word candidate. - jikouho_dai 0 To extract the next phrase candidate. - zenkouho 0 To extract the previous word candidate. - zenkouho_dai 0 To extract the previous phrase candidate. - select_jikouho 0 To extract the next group of word candidates. - select_jikouho_dai 0 To extract the next group of phrase cnadidates. - kana_henkan 1 To perform Hanzi_Pinyin (Bixing) conversion, ie. reverse conversion. - kill 156 To remove the characters from and including the cursor position, and store them in the "kill" buffer. - yank 156 - yank_e 1356 To insert the content of the "kill" buffer into the current cursor position. - bunsetu_nobasi 02 To increase one character to the length of a word. - bunsetu_nobasi_e 02 To decrease one character from the length of a word. - dic_utility 012 - 5-15 - - dic_utility_e 0123 To enter the dictionary operation state. - touroku 012 - touroku_e 0123 To enter the word addition state. - sainyuuryoku 1 - sainyuuryoku_e 13 To re-input the previously input character strings. - redraw_line 012456789 - redraw_line 0123456789 To redraw the conversion input line. - previous_history 1 - previous_history_e 13 To extract the previous string stored in history. - next_history 1 - next_history_e 13 To extract the next string stored in history. - touroku_mark_set 5 To set the beginning and ending position of the input string during word addition. When the beginning and ending position are the same, ie length of word is 0, return to the initial state. - touroku_return 6 To end the input of Pinyin (Bixing code) string during word addition. - quit 4567 When in a state other than conversion state and input state (eg. viewing of candidates for a Chinese character, word addition etc, state number 4,5,6,7), exit the state. - touroku_jump_forward 5 During word addition, move the cursor by one word to the front. - touroku_jump_backward 5 During word addition, move the cursor by one word to the rear. - 5-16 - - change_to_insert_mode 0 To change the converted input string back to insert mode, and there after, the converted Hanzi cannot change back to its Pinyin (or Bixing) form. - quote 1 - quote_e 13 To omit passing the next input character (except "henkan_on" ) to the input automaton conversion. Instead, pass it directly to the conversion line. - forward_select 4789 4 : When selecting candidates, the highlighted portion will move to the right. 789 : During dictionary search, if a line is not selected, it will scroll forward. - backward_select 4789 4 : When selecting candidates, the highlighted portion will move to the left. 789 : During dictionary search, if a line is not selected, it will scroll backward. - next_select 4789 4 : To move to the next screen during the selection of candidates. 789 : To move to the next line during dictionary search. - previous_select 4789 4 : To move to the previous screen during the selection of candidates. 789 : To move to the previous line during dictionary search. - linestart_select 4789 4 : To move to the top of the screen during the selection of candidates. 789 : During dictionary search, if a line is not selected, move to the first screen. - lineend_select 4789 4 : To move to the end of the screen during the selection of candidates. 789 : During dictionary search, if a line is not selected, move to the last screen. - select_select 4789 4 : During the selection of candidates, select one candidate and exit from this state. 789 : During dictionary search, select a candidate and exit from this state. - 5-17 - - send_ascii_char 0123456789 When the input buffer is empty, the ASCII character input will not be sent to the buffer. - not_send_ascii_char 0123456789 When the input buffer is empty, the ASCII character input will be sent to the buffer. - pop_send_ascii_char 0123456789 If the input buffer is empty, the operation of the ASCII character input will be changed back to the previous state. - toggle_send_ascii_char 0123456789 If the input buffer is empty, the operation of the ASCII character input will be reversed (ie. if the current operation is "send_ascii_char", then it will be set to "not_send_ascii_char" and vice versa). - quote_send_ascii_char In the "send_ascii_char" state, if the buffer is empty, the next ASCII character will enter the buffer. However, subsequent characters will not enter the buffer even if it is empty. - reconnect_jserver 012456789 To reconnect with the cserver - inspect 0 To check the dictionary. - sakujo_kouho 0 To delete a candidate. - del_entry 89 To delete dictionary as well as the words in the dictionary. - use_entry 89 To temporary stop and subsequently reuse the dictionary as well as the words in the dictionary. * Example ;Commands Code forward_char ^F 0x90 jikouho ^N 0x92 ^W 0x9E yank_e ^Y select_select 32 ^J ^M 0x9E 0x9F - 5-18 - * Note When the conversion state is OFF, the front-end processor will be temporary disconnected. Therefore, the input automaton also stops functioning. A key code refers to a code between 0 and 255. However, not all codes can be entered from the keyboard. To input a code that cannot be entered directly via the keyboard, use key code conversion (Refer to 5.7) or input automaton (Refer to chapter 6). * Reference uum(4.1), uumrc(5.3), cvt_key_tbl (5.7), romkan(6) - 5-19 - 5.7 cvt_key_tbl - KEY CODE CONVERSION TABLE FILE ================================================== * Description cvt_key_tbl - The key code conversion table for the front-end processor. * Standard path /usr/local/lib/wnn/cvt_key_tbl * Function To differentiate the character code of the keyboard from terminfo, and convert them to single characters according to the function. * Format [terminfo entry <space> code] (Unios-U) [termcap entry <space> code] (Unios-B) * Terminfo entries which can undergo conversion kf0, kf1, kf2, kf3, kf4, kf5, kf6, kf7, kf8, kf9, kf10, kf11, kf12, kf13, kf14, kf15, kf16, kf17, kf18, kf19, kf20, ksf21, kf22, kf23, kf24, kf25, kf26, kf27, kf28, kf29, kf30, kf31, kbs, ktbc, kclr, kctab, kdch1, kdll, kcud1, krmir, kel, ked, khome, kich1, kil1, kcub1, kll, knp, kpp, kcuf1, kind, kri, khts, kcuu1 * Termcap entries which can undergo conversion cs, rc, sc, se, so, us, ue, cm, ce, cl, bl, li, co * Code expression (1) Except for space, \ and ^ , all characters will be represented as they are. Example: A, 1. (2) ^<character> <character> can be @, A(a), B(b), C(c), D(d), E(e), F(f), ...Z(z), [, \ ,], ^, _ ^@ is Ctrl + space(0x00) ^A is Ctrl + A (0x01) : : ^_ is Ctrl + (0x1f) - 5-20 - (3) \<octal number>, \o<octal number>, \d<decimal number>, \x<hexadecimal number> character codes can be represented directly. Example: \x81 (4) \n, \t, \b, \r, \f, \e, \E represent NEWLINE, TAB, BACKSPACE, CR, FORMFEED, ESC, ESC respectively. (5) \<character> <character> can be any character except 0,1,2,3,4,5,6,7, o, d, x, n, t, b, r, f, e, E \\ means \ itself. * Example kf1 \x81 kf2 \x82 kf3 \x83 kf4 \x84 kcud1 \x92 kcub1 \x91 kcuf1 \x90 kcuu1 \x93 * Note Codes which are converted from this conversion code table will be evaluated in (a) input mode control table (2A_CTRL) of input automaton (b) uumkey * Reference uum(4.3), uumkey(5.6) - 5-21 -