Simple Templates
Simple template systems do direct translation, essentially eliminating the internal "knowledge representation" structures described in the prototypical machine translation scenario.
T.S. to translate simplified (restricted) English commands to DOS.
High level description of the system:
ACCEPTABLE INPUT ===> DOS EQUIVALENT
Almost considered essential to add this element:
UNACCEPTABLE INPUT ===> ERROR MESSAGE
And in most cases is would be appropriate to also add this:
ALMOST ACCEPTABLE INPUT ===> DOS EQUIVALENT
(with possibility of backing out)
Initial design of system (as well as a description of any similar translation scheme) is just a table:
| INPUT | OUTPUT | ACTION (possible provision) |
|---|---|---|
| accptbl cmmd1 | DOS equiv1 | execute command |
| accptbl cmmd2 | DOS equiv2 | execute command |
|
: : : |
||
| accptbl cmmdm | DOS equivm | execute command |
| almost accptbl cmmd1 | DOS equiv1 | execute command |
| almost accptbl cmmd2 | DOS equiv2 | execute command |
|
: : : |
||
| almost accptbl cmmdn | DOS equivn | execute command |
Concrete prototype of above translation table
INPUT OUTPUT ----------------- -------------------- What is on disk A? DIR A: What is on drive A? DIR A: What is on the disk in drive A? DIR A: What is on disk B? DIR B: What is on drive B? DIR B: What is on the disk in drive B? DIR B:
First abstraction:
We need to handle arbitrary drive names. Solution: create a "token" (syntactic entity) to represent any letter. We'll use _X. [Note how this is like "token classes" in grammars.]
The table becomes:
INPUT OUTPUT ----------------- -------------------- What is on disk _X? DIR $(_X): What is on drive _X? DIR $(_X): What is on the disk in drive _X? DIR $(_X):