0
|
1
|
|
2 *************************************************
|
|
3 * Chapter 6 INPUT AUTOMATION *
|
|
4 *************************************************
|
|
5
|
|
6
|
|
7
|
|
8
|
|
9 6.1 OVERVIEW
|
|
10 ============
|
|
11
|
|
12 The input automaton, also known as user input automaton, is used for converting
|
|
13 the user's input into the standard internal representation used by the system. The
|
|
14 conversion is done automatically, and the definition of the input automaton is set via
|
|
15 the environment.
|
|
16
|
|
17
|
|
18 1. Structure of Input Automaton
|
|
19 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
20 The diagram below shows the structure of the input automaton. The "input"
|
|
21 refers to the user input from the keyboard, and "output" refers to the final output
|
|
22 received by the system. The mapping from input to output is performed by the input
|
|
23 automaton. Environment setting defines the mapping process from input to output.
|
|
24 Through environment setting, different types of input automaton mapping relationships
|
|
25 can be defined. At the same time, the input automaton is capable of perform automaton
|
|
26 input by providing appropriate feedback characters which are sent back to the input
|
|
27 automaton automatically.
|
|
28
|
|
29 +----------------------------------------------------+
|
|
30 | |
|
|
31 | +--------------+ |
|
|
32 | Input ----->| Input |-----> Output |
|
|
33 | +---->| Automaton | |
|
|
34 | | +--------------+ |
|
|
35 | | ^ | |
|
|
36 | | | V |
|
|
37 | feedback | +--+-------------------+ |
|
|
38 | +-------| Environment Setting | |
|
|
39 | +----------------------+ |
|
|
40 | |
|
|
41 +----------------------------------------------------+
|
|
42 Figure 6.1 : Structure of Input Automaton
|
|
43 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
44
|
|
45
|
|
46
|
|
47
|
|
48
|
|
49
|
|
50 - 6-1 -
|
|
51 During the startup of cuum (client), the initial environment setting of the
|
|
52 input automaton is read via the standard path. After this, the user can input through
|
|
53 the input automaton. There is a default input automaton environment in the system.
|
|
54 However, the user is able to define his own input automaton environment. In other
|
|
55 words, he can set his individual input environment via the "environment setting".
|
|
56
|
|
57 "Environment setting" is done by using a simple language similar to "Lisp".
|
|
58 This is stored in the system as source files. During cuum startup, it first reads in
|
|
59 all the environment files, and subsequently convert them to internal format used by
|
|
60 the system. The characteristics of the input automaton is entirely dependent on the
|
|
61 "environment setting". Thus, from the user's viewpoint, the "environmnet setting" is
|
|
62 the input automaton.
|
|
63
|
|
64
|
|
65 2. User Input Environment
|
|
66 ~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
67 (a) Phonetic input
|
|
68 Definition of Pinyin input is possible through the definition of the input
|
|
69 automaton. Hence for all Pinyin input (including Quanpin, Erpin, Sanpin
|
|
70 together with the four tones), the system will always receive the standard
|
|
71 Pinyin.
|
|
72
|
|
73 The input automaton also performs a checking for legal pinyin input.
|
|
74 When user inputs a Pinyin (external representation), the automaton converts it
|
|
75 to its internal representation. This internal representation is treated as a
|
|
76 unit by the system. This has also made Pinyin tone error tolerance possible.
|
|
77
|
|
78 (b) Radical input
|
|
79 Through the definition of the input automaton, different types of radical
|
|
80 input can be defined. Besides, internal code input, Quwei input, Guobiao as
|
|
81 well as other inputs of Hanzi are also possible.
|
|
82
|
|
83 Similarly, the "environment setting" for radical input is done by using a
|
|
84 simple language similar to "Lisp". This is stored in the system as source
|
|
85 files. During the startup of the client, it first reads in all the environment
|
|
86 files, and subsequently convert them to internal format used by the system.
|
|
87 The characteristics of the input automaton is entirely dependent on the
|
|
88 "environment setting". Thus, from the user's viewpoint, the
|
|
89 "environmnet setting" is the input automaton.
|
|
90
|
|
91
|
|
92
|
|
93
|
|
94
|
|
95
|
|
96
|
|
97
|
|
98
|
|
99
|
|
100 - 6-2 -
|
|
101 3. Setting of Input Automaton
|
|
102 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
103 During startup of front-end processor "cuum", the mode definition file is searched in
|
|
104 the following order :
|
|
105
|
|
106 (a) During startup, the path of input automaton is set using the "-r" option of cuum.
|
|
107 If the path indicated is a directory name, the system will read in the file "mode"
|
|
108 under the directory.
|
|
109
|
|
110 (b) In the initialization files "uumrc" of cuum, the path is set via the "setautofile"
|
|
111 command. If the path is a directory name, the system will read in the file "mode"
|
|
112 under the directory.
|
|
113
|
|
114 (c) If (a) and (b) are not set or the file does not exist, the respective standard
|
|
115 path for cuum will be read. The standard path is as follows :
|
|
116
|
|
117 /usr/local/lib/wnn/zh_CN/rk/mode
|
|
118
|
|
119
|
|
120
|
|
121
|
|
122
|
|
123
|
|
124
|
|
125
|
|
126
|
|
127
|
|
128
|
|
129
|
|
130
|
|
131
|
|
132
|
|
133
|
|
134
|
|
135
|
|
136
|
|
137
|
|
138
|
|
139
|
|
140
|
|
141
|
|
142
|
|
143
|
|
144
|
|
145
|
|
146
|
|
147
|
|
148
|
|
149
|
|
150 - 6-3 -
|
|
151
|
|
152 6.2 CONVERSION METHOD
|
|
153 =====================
|
|
154
|
|
155 An input automaton consists of a mode definition table and several mapping
|
|
156 tables, collectively known as the conversion table. Figure 6.3 shows the logical
|
|
157 structure of input automaton conversion tables. The mode definition table describes
|
|
158 the mapping tables of the input automaton and relationships among them.
|
|
159 One input mode provides one input method at the user interface. The mapping
|
|
160 tables show (1) Mapping from the input to output shown in Figure 6.1
|
|
161 (2) Feedback input via environment setting
|
|
162 (3) State of the mode variables
|
|
163
|
|
164 The mapping table describes the variable definitions and the mapping relationship.
|
|
165 It can be divided into initial mapping table, intermediate mapping table and final
|
|
166 mapping table as shown below :
|
|
167
|
|
168 +---------------------------------------------------------------------+
|
|
169 | |
|
|
170 | +--- (1) Mode definition table |
|
|
171 | Input automaton --| |
|
|
172 | +--- (2) Mapping |
|
|
173 | table --+--- Initial mapping table |
|
|
174 | |--- Intermediate mapping table |
|
|
175 | +--- Final mapping table |
|
|
176 | |
|
|
177 +---------------------------------------------------------------------+
|
|
178 Figure 6.2 Structure of Input Automaton Description Language
|
|
179 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
180
|
|
181
|
|
182
|
|
183
|
|
184
|
|
185
|
|
186
|
|
187
|
|
188
|
|
189
|
|
190
|
|
191
|
|
192
|
|
193
|
|
194
|
|
195
|
|
196
|
|
197
|
|
198
|
|
199
|
|
200 - 6-4 -
|
|
201 During the input automaton mapping process, the input first undergoes the
|
|
202 initial mapping as shown in Figures 6.3. The result (output-1) is then passed to
|
|
203 the intermediate mapping table as input, and subsequently output-2 is passed as
|
|
204 input for final mapping. Output-3 is the final output of the input automaton.
|
|
205 The feedback shown in diagram is treated as input to the intermediate mapping.
|
|
206
|
|
207 +---------------------------------------------------------------------------+
|
|
208 | Initial Intermediate Final |
|
|
209 | mapping mapping mapping |
|
|
210 | +-------+ +-----------+ +---------+ |
|
|
211 | Input ->| e E |output-1| EU Eu |output-2| E Ch | output-3 |
|
|
212 | | u U |------->| . . |------->| A Sh |-----> |
|
|
213 | | . . | +-->| . . | | V Zh | |
|
|
214 | +-------+ | +-----------+ +---------+ |
|
|
215 | | | feedback |
|
|
216 | | V |
|
|
217 | +-----------+ |
|
|
218 +---------------------------------------------------------------------------+
|
|
219 Figure 6.3 Input Automaton Process
|
|
220 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
221
|
|
222 The mode definition table consists of the mode variable definitions and the input
|
|
223 mode expressions. In mode definition table, the setting sequence of the mapping
|
|
224 tables must be initial, intermediate, and followed by final mapping.
|
|
225
|
|
226
|
|
227
|
|
228
|
|
229
|
|
230
|
|
231
|
|
232
|
|
233
|
|
234
|
|
235
|
|
236
|
|
237
|
|
238
|
|
239
|
|
240
|
|
241
|
|
242
|
|
243
|
|
244
|
|
245
|
|
246
|
|
247
|
|
248
|
|
249
|
|
250 - 6-5 -
|
|
251
|
|
252 6.3 MODE DEFINITION TABLE
|
|
253 =========================
|
|
254
|
|
255 The mode definition table describes the definition of the mode variables,
|
|
256 input modes, as well as the relation among the different input modes. The table is
|
|
257 made up of the following three types of expressions :
|
|
258
|
|
259
|
|
260 1. Mode Variable Definition
|
|
261 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
262 (defmode <mode name> [initial state])
|
|
263
|
|
264 * Mode name
|
|
265 Begins with an alphabet. Consists of numbers and alphabets. The mode
|
|
266 variable may have two values : ON and OFF.
|
|
267
|
|
268 * Initial state
|
|
269 The initial state can be ON or OFF. This indicates the initial state of
|
|
270 the mode variable. Default is OFF.
|
|
271
|
|
272 * A mode variable must be defined before it can be used.
|
|
273
|
|
274
|
|
275 2. Search Path of Mapping Table
|
|
276 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
277 Mapping tables which appear in the mode definition table are assumed to have the
|
|
278 same path as the mode definition table. If the path is different, the directory
|
|
279 name has to be set as follows :
|
|
280
|
|
281 (search pathname ... ...)
|
|
282
|
|
283 * Several pathnames may be set, each separated by a separator.
|
|
284 * The path must be defined before the mapping tables.
|
|
285
|
|
286
|
|
287
|
|
288
|
|
289
|
|
290
|
|
291
|
|
292
|
|
293
|
|
294
|
|
295
|
|
296
|
|
297
|
|
298
|
|
299
|
|
300 - 6-6 -
|
|
301 3. Input Mode Expression
|
|
302 ~~~~~~~~~~~~~~~~~~~~~~~~
|
|
303 The definition of the input mode can be done in the following three ways :
|
|
304 (a) Mapping table [mapping table ...] mode indicator
|
|
305 (b) ( if condition mapping table [mapping table ...] Mode indicator )
|
|
306 (c) ( When condition mapping table [mapping table ...] Mode indicator )
|
|
307
|
|
308 "mapping table" is an identifier that specifies an actual file in the current search
|
|
309 path. The file describes the input condition under the current input mode.
|
|
310 Both "if" and "when" are conditional statements, with some differences between them.
|
|
311 For "if" statements, if the condition is ture, the remaining part of the "if" statement
|
|
312 will be evaluated, and the next statement will not be evaluated. If the condition is
|
|
313 false, leave the current "if" statement and proceed to evaluate the next statement.
|
|
314 For "when" statements, if the condition is true, the remaining part of the "when"
|
|
315 statement will be evaluated; otherwise the remaining part will not be evaluated. In any
|
|
316 case, the next statement after the "when" statement will be evaluated.
|
|
317
|
|
318 In the mode definition table, the identifier of initial mapping tables begin with a "1".
|
|
319 Intermediate mapping tables begin with a "2"and final mapping tables begin with a "3".
|
|
320
|
|
321 The mapping tables must follow the sequence of initial, intermediate and final.
|
|
322 There may be several mapping tables in each stage (initial, intermediate, final).
|
|
323
|
|
324 The "mode indicator" can be represented by a string of characters quoted in " ", to
|
|
325 indicate the current input mode to the user. If there are more than one mode indicator
|
|
326 in the mode expression, only the last indicator is valid.
|
|
327
|
|
328
|
|
329
|
|
330 Condition Definition
|
|
331 ~~~~~~~~~~~~~~~~~~~~
|
|
332 The "condition" above can be expressed in the following ways :
|
|
333
|
|
334 +-----------------------------------------------------------------------------+
|
|
335 | Mode variable name | ON when true, OFF when false |
|
|
336 |---------------------------+-------------------------------------------------|
|
|
337 |(and condition condition) |True when both conditions are true. |
|
|
338 | | |
|
|
339 |(or condition condition) |True when at least one of the two conditions is |
|
|
340 | |true. |
|
|
341 | | |
|
|
342 |( not condition ) |True when the condition is false |
|
|
343 | | |
|
|
344 |( false ) |False |
|
|
345 | | |
|
|
346 |( true ) |True |
|
|
347 +-----------------------------------------------------------------------------+
|
|
348
|
|
349
|
|
350 - 6-7 -
|
|
351
|
|
352 <Table-c-6.1>
|
|
353
|
|
354
|
|
355
|
|
356
|
|
357
|
|
358
|
|
359
|
|
360
|
|
361
|
|
362
|
|
363
|
|
364
|
|
365
|
|
366
|
|
367
|
|
368
|
|
369
|
|
370
|
|
371
|
|
372
|
|
373
|
|
374
|
|
375
|
|
376
|
|
377
|
|
378
|
|
379
|
|
380
|
|
381
|
|
382
|
|
383
|
|
384
|
|
385
|
|
386
|
|
387
|
|
388
|
|
389
|
|
390
|
|
391
|
|
392
|
|
393
|
|
394
|
|
395
|
|
396
|
|
397
|
|
398
|
|
399
|
|
400 - 6-8 -
|
|
401
|
|
402 6.4 MAPPING TABLES
|
|
403 ==================
|
|
404
|
|
405 The relation between input and output of the input automaton in any input mode
|
|
406 is represented in the mapping tables. The mapping tables consist of the initial,
|
|
407 intermediate and final mapping tables. In the whole process, the intermediate mapping
|
|
408 plays the main role, with the initial and final mapping acting as the preparation and
|
|
409 touchings respectively.
|
|
410
|
|
411 Each process table has its own representation as shown below:
|
|
412 (a) Initial mapping table
|
|
413 (a0) Character variable definition
|
|
414 (a1) Input character representation [output character representation]
|
|
415
|
|
416 (b) Intermediate mapping table
|
|
417 (b0) Character variable definition
|
|
418 (b1) Input character string representation [output character representation]
|
|
419 [feedback character string representation]
|
|
420 (b2) Input character string representation operation
|
|
421
|
|
422 (c) Final mapping table
|
|
423 (c0) Character variable definition
|
|
424 (c1) Input character representation [output character string representation]
|
|
425
|
|
426
|
|
427 The initial mapping can only perform mapping between characters. Intermediate
|
|
428 mapping is able to perform mapping between character strings, and final mapping can
|
|
429 perform mappings from character and character string. Besides, feedback input can
|
|
430 only be provided by the intermediate mapping.
|
|
431
|
|
432 In the above (a1) -- if the input character matches the character in
|
|
433 "input character representation", the input automaton converts it
|
|
434 to the character in "output character representation".
|
|
435
|
|
436 (b1) -- if the input character string matches the character string in
|
|
437 "input character string representation", the input automaton
|
|
438 converts it to the character string in "output character string
|
|
439 representation".
|
|
440 During output, the "feedback character string representation" will
|
|
441 be treated as new input to intermediate mapping.
|
|
442
|
|
443
|
|
444
|
|
445
|
|
446
|
|
447
|
|
448
|
|
449
|
|
450 - 6-9 -
|
|
451 (b2) -- if the input character matches the character in
|
|
452 "input character representation", the input automaton performs the
|
|
453 operation on the mode variables.
|
|
454
|
|
455 (c1) -- if the input character matches the character in
|
|
456 "input character representation", the input automaton converts it
|
|
457 to the character string in "output character string representation".
|
|
458
|
|
459 Note:
|
|
460 ~~~~
|
|
461 * In the above (a) (b) and (c), parts in [ ] are options.
|
|
462 * One expression should be in the same line. If there is not enough space for
|
|
463 the expression, it can be continued in the following line by using the \.
|
|
464 * Anything after a semicolon ";" in a line is treated as comment.
|
|
465
|
|
466
|
|
467
|
|
468
|
|
469
|
|
470
|
|
471
|
|
472
|
|
473
|
|
474
|
|
475
|
|
476
|
|
477
|
|
478
|
|
479
|
|
480
|
|
481
|
|
482
|
|
483
|
|
484
|
|
485
|
|
486
|
|
487
|
|
488
|
|
489
|
|
490
|
|
491
|
|
492
|
|
493
|
|
494
|
|
495
|
|
496
|
|
497
|
|
498
|
|
499
|
|
500 - 6-10 -
|
|
501 1. Variable Definition
|
|
502 ~~~~~~~~~~~~~~~~~~~~~~
|
|
503 Through definitions and the use of variables, similar mapping relations can be
|
|
504 described easily and effectively. The format of variable definition is as follows:
|
|
505
|
|
506 (a) (defvar variable name (list character ... ...))
|
|
507 (b) (defvar variable name (all))
|
|
508
|
|
509 In (a), variable name can be any of the characters in list. In (b), the variable
|
|
510 name can be any character. The example below show the similar conversion relations.
|
|
511
|
|
512 * example 1:
|
|
513 (defvar A (list B C D) )
|
|
514 (A)A (A)a
|
|
515
|
|
516 * example 2:
|
|
517 BA Ba
|
|
518 CA Ca
|
|
519 DA Da
|
|
520
|
|
521 During the definition and use of variables,
|
|
522 (a) The variable must be defined before it is used.
|
|
523 (b) The variable definition is valid for all the current mapping tables.
|
|
524 (c) Besides the current mapping tables, the variable definition is not valid for
|
|
525 other tables.
|
|
526 (d) Variables in the same line have the same value. For example :
|
|
527
|
|
528 (defvar a1 (list A B))
|
|
529 (a1) (tolower(a1)) 3
|
|
530
|
|
531 When input [Aa] or [Bb], the result will be 3. However, there is no match
|
|
532 when input is [Ab] or [Ba]. Besides, variable that occurs in the remaining
|
|
533 character string must also appear at the same input character string.
|
|
534
|
|
535
|
|
536
|
|
537
|
|
538
|
|
539
|
|
540
|
|
541
|
|
542
|
|
543
|
|
544
|
|
545
|
|
546
|
|
547
|
|
548
|
|
549
|
|
550 - 6-11 -
|
|
551 2. Evaluation of Characters
|
|
552 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
553 The format of representing a character is shown below. This format is different
|
|
554 from the character string representation. The evaluation result of the character
|
|
555 representation must be a character, and character can be a single character and
|
|
556 multi-characters.
|
|
557
|
|
558 (a) Character representation
|
|
559 Character -- Character other than ---- ( ) ' \ " ; SP
|
|
560 'Character' -- Character other than ---- ' \ ^
|
|
561 '^Character' -- Indicates control character <ctrl + character>. The
|
|
562 character must be between 64-95 or lower case alphabets.
|
|
563 '\Character' -- Indicates special characters. Generally, '\character'
|
|
564 refers to the character after [\]. Besides,
|
|
565 '\n', '\t', '\b', '\r', '\f' having the same
|
|
566 meanings as C language; '\e', '\E' represent ESC;
|
|
567 and '\8 ...' '\o...', '\d ...' ,'\x ...' represent
|
|
568 octal, decimal and hexadecimal repsectively.
|
|
569
|
|
570
|
|
571
|
|
572
|
|
573
|
|
574
|
|
575
|
|
576
|
|
577
|
|
578
|
|
579
|
|
580
|
|
581
|
|
582
|
|
583
|
|
584
|
|
585
|
|
586
|
|
587
|
|
588
|
|
589
|
|
590
|
|
591
|
|
592
|
|
593
|
|
594
|
|
595
|
|
596
|
|
597
|
|
598
|
|
599
|
|
600 - 6-12 -
|
|
601 (b) Function representation
|
|
602 There are some special functions in the automaton. These functions can be used
|
|
603 in direct representation. The table below gives a summary of the functions.
|
|
604
|
|
605
|
|
606 <Table-c-6.2>
|
|
607
|
|
608
|
|
609
|
|
610
|
|
611
|
|
612
|
|
613
|
|
614
|
|
615
|
|
616
|
|
617
|
|
618
|
|
619
|
|
620
|
|
621
|
|
622
|
|
623
|
|
624
|
|
625
|
|
626
|
|
627
|
|
628
|
|
629
|
|
630
|
|
631
|
|
632
|
|
633
|
|
634
|
|
635
|
|
636
|
|
637
|
|
638
|
|
639
|
|
640
|
|
641 Function representation format :
|
|
642 < 1 > (function name operand)
|
|
643 < 2 > (function name operand operand)
|
|
644
|
|
645
|
|
646
|
|
647
|
|
648
|
|
649
|
|
650 - 6-13 -
|
|
651 3. Evaluation of Character String
|
|
652 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
653 The character string representation is a sequence of character representations,
|
|
654 which has been described in 2 (Evaluation of characters). The evaluation result of the
|
|
655 character string representation is also a character string, can be a single character
|
|
656 as well as multi-characters.
|
|
657
|
|
658 (a) Character representation
|
|
659 Similar to the character representation and evaluation in 2 (Evaluation of
|
|
660 characters).
|
|
661
|
|
662 (b) Function representaiton
|
|
663 * function last=
|
|
664 If the last character of the most recently mapped character string matches the
|
|
665 function parameter, the function evaluates to an empty string.
|
|
666
|
|
667 * function todigit
|
|
668 Convert the code given by the first parameter to the value in the base of the
|
|
669 code given by the second parameter.
|
|
670
|
|
671
|
|
672
|
|
673
|
|
674
|
|
675
|
|
676
|
|
677
|
|
678
|
|
679
|
|
680
|
|
681
|
|
682
|
|
683
|
|
684
|
|
685
|
|
686
|
|
687
|
|
688
|
|
689
|
|
690
|
|
691
|
|
692
|
|
693
|
|
694
|
|
695
|
|
696
|
|
697
|
|
698
|
|
699
|
|
700 - 6-14 -
|
|
701 (c) Mode operation and evaluation
|
|
702
|
|
703 Function name Function
|
|
704 ~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
705 if To evaluate the state of mode operation.
|
|
706 If ON, it will be treated as empty character string.
|
|
707
|
|
708 unless To evaluate the state of mode operation.
|
|
709 If OFF, it will be treated as empty character string.
|
|
710
|
|
711 on To set the state of mode operation to ON.
|
|
712
|
|
713 off To set the state of mode operation to OFF.
|
|
714
|
|
715 switch To switch the mode operation state.
|
|
716 In other words, if the state is ON, set it to OFF
|
|
717 and vice versa.
|
|
718
|
|
719 allon Set all modes to ON.
|
|
720
|
|
721 alloff Set all modes to OFF.
|
|
722
|
|
723 (error) Error handling for input keys that cannot be mapped.
|
|
724
|
|
725 (restart) To read in new mode definition table and re-define
|
|
726 the conversion. If error exists in the new conversion
|
|
727 table, an error message will be given and the system
|
|
728 returns to the settings of the original conversion
|
|
729 table.
|
|
730
|
|
731 Note : * Function "if" and "unless" can only be used in the input character
|
|
732 string representations;
|
|
733 * "on", "off" and "switch" can only be used in the output character
|
|
734 string representations;
|
|
735 * "allon" and "alloff" and "(error)" can only be used in the output
|
|
736 character string representations of intermediate mapping tables.
|
|
737 * "(restart)" is used by itself.
|
|
738
|
|
739
|
|
740
|
|
741
|
|
742
|
|
743
|
|
744
|
|
745
|
|
746
|
|
747
|
|
748
|
|
749
|
|
750 - 6-15 -
|
|
751
|
|
752 6.5 EXAMPLE OF MODE DEFINITION
|
|
753 ==============================
|
|
754
|
|
755 We have introduced the input automaton in the above sections. We will now
|
|
756 give an example of a simple input automaton, using front-end processor "cuum".
|
|
757 Take note that some of the definitions are different from the standard definition.
|
|
758 For example, only two Pinyin input definitions are given here and the Bixing input
|
|
759 definitions are not included.
|
|
760 Users who are interested in the input automaton can refer directly to the
|
|
761 files under the standard path.
|
|
762
|
|
763
|
|
764 1. Mode Definition Table (mode)
|
|
765 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
766 * Standard path
|
|
767 /usr/local/lib/wnn/zh_CN/rk/rk/mode
|
|
768
|
|
769 * Content
|
|
770 Relation between mode variables and input mode.
|
|
771
|
|
772
|
|
773 <Table-c-6.3>
|
|
774
|
|
775
|
|
776
|
|
777
|
|
778
|
|
779
|
|
780
|
|
781
|
|
782
|
|
783
|
|
784
|
|
785
|
|
786
|
|
787
|
|
788
|
|
789
|
|
790
|
|
791
|
|
792
|
|
793
|
|
794
|
|
795
|
|
796
|
|
797
|
|
798
|
|
799
|
|
800 - 6-16 -
|
|
801 2. Mode Control Table (2A_CTRL)
|
|
802 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
803 * Standard path
|
|
804 /usr/local/lib/wnn/zh_CN/rk/2A_CTRL
|
|
805
|
|
806 * Content
|
|
807 Control of mode variables
|
|
808
|
|
809 (defvar pf1 (list '\x81') )
|
|
810 (defvar pf2 (list '\x82') )
|
|
811
|
|
812 (unless PIN_YIN)(pf1) (on PIN_YIN)(off ASCII)
|
|
813 (if PIN_YIN)(pf1) (switch QUAN_PIN)(switch ER_PIN)
|
|
814
|
|
815 (unless ASCII)(pf2) (on ASCII)(off PIN_YIN)
|
|
816 (if ASCII)(pf2) (switch QUAN_JIAO)(switch BAN_JIAO)
|
|
817
|
|
818
|
|
819 3. Quanpin Mapping Table (2P_QuanPin)
|
|
820 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
821 * Standard path
|
|
822 /usr/local/lib/wnn/zh_CN/rk/2P_QuanPin
|
|
823
|
|
824 * Content
|
|
825 Mapping table of Quanpin input
|
|
826
|
|
827 (defvar A (list B C D F G H K L M N P S T W Y Z ))
|
|
828 (defvar AI (list B C D G H K L M N P S T W Z ))
|
|
829 (defvar AN (list B C D F G H K L M N P R S T W Y Z )) ;ANG
|
|
830 (defvar AO (list B C D G H K L M N P R S T W Y Z ))
|
|
831 (defvar E (list B C D G H K L M N R S T Y Z ))
|
|
832 . . . . . .
|
|
833
|
|
834
|
|
835 <Table-c-6.4>
|
|
836
|
|
837
|
|
838
|
|
839
|
|
840
|
|
841
|
|
842
|
|
843
|
|
844
|
|
845
|
|
846
|
|
847
|
|
848
|
|
849
|
|
850 - 6-17 -
|
|
851 4. Erpin Mapping Table (ER_PIN)
|
|
852 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
853 * Standard path
|
|
854 /usr/local/lib/wnn/zh_CN/rk/2P_ErPin
|
|
855
|
|
856 * Content
|
|
857 Mapping table of Erpin input
|
|
858
|
|
859 (defvar A (list B C E D F G H K L M N P S A T W Y Z V))
|
|
860 (defvar AI (list B C E D G H K L M N P S A T W Z V))
|
|
861 (defvar AN (list B C E D F G H K L M N P R S A T W Y Z V));ANG
|
|
862 (defvar AO (list B C E D G H K L M N P R S A T W Y Z V))
|
|
863 (defvar E (list B C E D G H K L M N R S A T Y Z V))
|
|
864 . . . . . .
|
|
865
|
|
866
|
|
867 <Table-c-6.5>
|
|
868
|
|
869
|
|
870
|
|
871
|
|
872
|
|
873
|
|
874
|
|
875
|
|
876
|
|
877
|
|
878
|
|
879
|
|
880
|
|
881
|
|
882
|
|
883
|
|
884
|
|
885
|
|
886
|
|
887
|
|
888
|
|
889
|
|
890
|
|
891
|
|
892
|
|
893
|
|
894
|
|
895
|
|
896
|
|
897
|
|
898
|
|
899
|
|
900 - 6-18 -
|
|
901 5. Pinyin Error Correction Table
|
|
902 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
903 * Standard path
|
|
904 /usr/local/lib/wnn/zh_CN/rk/2P_RongCuo
|
|
905
|
|
906 * Content
|
|
907 The auto-correcting definition in the Pinyin input
|
|
908
|
|
909
|
|
910 <Table-c-6.6>
|
|
911
|
|
912
|
|
913
|
|
914
|
|
915
|
|
916
|
|
917
|
|
918
|
|
919
|
|
920
|
|
921
|
|
922
|
|
923
|
|
924
|
|
925
|
|
926
|
|
927
|
|
928
|
|
929
|
|
930
|
|
931
|
|
932
|
|
933
|
|
934
|
|
935
|
|
936
|
|
937
|
|
938
|
|
939
|
|
940
|
|
941
|
|
942
|
|
943
|
|
944
|
|
945
|
|
946
|
|
947
|
|
948
|
|
949
|
|
950 - 6-19 -
|
|
951 6. Other Mapping Tables
|
|
952 ~~~~~~~~~~~~~~~~~~~~~~~
|
|
953
|
|
954 (a) 1B_TOUPPER mapping table
|
|
955 Convert the input characters into upper case alphabets.
|
|
956
|
|
957 (defvar low (all))
|
|
958 (low) (toupper (low))
|
|
959
|
|
960 (b) 2P_Tail mapping table
|
|
961
|
|
962 <Table-c-6.7>
|
|
963
|
|
964
|
|
965
|
|
966
|
|
967
|
|
968
|
|
969
|
|
970
|
|
971 (c) 3B_QuanJiao mapping table
|
|
972 Convert the input characters to wide ASCII characters.
|
|
973
|
|
974 (defvar a (all))
|
|
975 (a) (toQalpha (a))
|
|
976
|
|
977
|
|
978 The above mode definition table defines the "Pinyin" , "Erpin", "Banjiao"
|
|
979 character and "Quanjiao" input modes.
|
|
980
|
|
981 Initially -- PIN_YIN mode is set to OFF
|
|
982 -- QUAN_PIN mode under PIN_YIN is set to ON
|
|
983 -- ER_PIN is set to OFF
|
|
984 -- ASCII mode is set to ON
|
|
985 -- BAN_JIAO mode under ASCII is set to ON
|
|
986 -- QUAN_JIAO mode under ASCII is set to OFF
|
|
987
|
|
988
|
|
989 From the above definitions in the mode definition table, during the initial
|
|
990 state, the input automaton receives Banjiao input. Notice that the BAN_JIAO state
|
|
991 under the ASCII state has no mapping table, this means that the user input is
|
|
992 received directly by the system. To input Pinyin, user needs to change the mode to
|
|
993 QUAN_PIN (under PIN_YIN). The way of changing the mode is defined in the mapping
|
|
994 table 2A_CTRL ( see next paragraph ). Here, we assume that we are already in the
|
|
995 QUAN_PIN mode, and the input automaton receives Pinyin input.
|
|
996
|
|
997
|
|
998
|
|
999
|
|
1000 - 6-20 -
|
|
1001 Note that from the above mode definition table, the automaton will first
|
|
1002 follow the definition of mapping table 1B_TOUPPER to convert the actual user input
|
|
1003 to upper case alphabets. Subsequently, the automaton creates the "actual input
|
|
1004 received by the system" based on mapping tables 2P_QuanPin, 2P_RongCuo and 2P_Tail.
|
|
1005 We will now show a simple example.
|
|
1006
|
|
1007
|
|
1008 <Table-c-6.8>
|
|
1009
|
|
1010
|
|
1011
|
|
1012
|
|
1013
|
|
1014
|
|
1015 Similarly, the user is able to change the mode to Erpin mode to input Hanzi, or
|
|
1016 change to Quanjiao mode to input wide ASCII characters.
|
|
1017
|
|
1018
|
|
1019
|
|
1020
|
|
1021
|
|
1022
|
|
1023
|
|
1024
|
|
1025
|
|
1026
|
|
1027
|
|
1028
|
|
1029
|
|
1030
|
|
1031
|
|
1032
|
|
1033
|
|
1034
|
|
1035
|
|
1036
|
|
1037
|
|
1038
|
|
1039
|
|
1040
|
|
1041
|
|
1042
|
|
1043
|
|
1044
|
|
1045
|
|
1046
|
|
1047
|
|
1048
|
|
1049
|
|
1050 - 6-21 -
|