Rdb: Ruby-Nachbau der MWC /rdb-Werkzeuge
This commit is contained in:
@@ -0,0 +1,121 @@
|
||||
.TH translate "" "" "/rdb Command"
|
||||
.PC "Word-for-word substitution using a translation file"
|
||||
\fBtranslate \fIlanguage \fB< \fItext \fB> \fItranslatedtext\fB
|
||||
.PP
|
||||
.II "text^translate"
|
||||
The command
|
||||
.B translate
|
||||
performs word-for-word replacement on
|
||||
.IR text .
|
||||
You can use it to perform crude translations from one language to
|
||||
another.
|
||||
.PP
|
||||
.B translate
|
||||
uses either
|
||||
.BR m4 ,
|
||||
.BR sed ,
|
||||
or both.
|
||||
For
|
||||
.BR m4 ,
|
||||
.B translate
|
||||
needs a define file generated by the
|
||||
.B /rdb
|
||||
command
|
||||
.BR tabletom4 ;
|
||||
the define file must be named
|
||||
.IR language .
|
||||
For
|
||||
.BR sed ,
|
||||
it needs a preprocessing file and can also use a postprocessing file,
|
||||
both generated by the command
|
||||
.BR tabletosed ;
|
||||
the preprocessing file must be named \fIlanguage\fB.sed.1\fR, and the
|
||||
postprocessing file must be named \fBlanguage\fB.sed.2\fR.
|
||||
See the manual pages for these
|
||||
.B /rdb
|
||||
commands for a description of the sort of table they require as input.
|
||||
.SH Example
|
||||
Suppose we have a simple translation for English to Deutsch (German),
|
||||
called
|
||||
.BR ed.t :
|
||||
.DM
|
||||
English Deutsch
|
||||
------- -------
|
||||
I Ich
|
||||
love liebe
|
||||
you dich
|
||||
widgit
|
||||
.DE
|
||||
.PP
|
||||
The command
|
||||
.DM
|
||||
tabletom4 < ed.t > ed
|
||||
.DE
|
||||
.PP
|
||||
generates the
|
||||
.B m4
|
||||
definition file
|
||||
.BR ed ,
|
||||
which contains the following:
|
||||
.DM
|
||||
define(I,Ich)
|
||||
define(love,liebe)
|
||||
define(you,dich)
|
||||
.DE
|
||||
.PP
|
||||
Note that
|
||||
.B tabletom4
|
||||
did not convert
|
||||
.B widgit
|
||||
because this word had no translation in the table.
|
||||
.PP
|
||||
Now, if file
|
||||
.B text
|
||||
contains the sentence
|
||||
.DM
|
||||
I love you.
|
||||
.DE
|
||||
.PP
|
||||
you can use
|
||||
.B translate
|
||||
to translate it into German.
|
||||
Typing
|
||||
.DM
|
||||
translate ed text
|
||||
.DE
|
||||
.PP
|
||||
prints the following on the standard output:
|
||||
.DM
|
||||
Ich liebe dich.
|
||||
.DE
|
||||
.PP
|
||||
.B translate
|
||||
has also been used in a biomedical expert system.
|
||||
The idea is to convert each word into its value after looking it
|
||||
up in a table.
|
||||
For example:
|
||||
.DM
|
||||
Var Value
|
||||
------- -------
|
||||
age 42
|
||||
weight 80
|
||||
...
|
||||
.DE
|
||||
.PP
|
||||
This is something the Lisp language does frequently.
|
||||
.PP
|
||||
.B translate
|
||||
can also be used to construct form letters.
|
||||
.SH "See Also"
|
||||
.B
|
||||
tabletom4,
|
||||
tabletosed,
|
||||
word
|
||||
.R
|
||||
.br
|
||||
COHERENT Lexicon:
|
||||
.B
|
||||
m4,
|
||||
sed
|
||||
.R
|
||||
.SO translate
|
||||
Reference in New Issue
Block a user