public class DefaultTranslator extends java.lang.Object implements Translator
Translator
interface.
Partial translations are created through a BilingualCorpus
respecting
the constituent structure of the input text, which is analyzed by an
Analyzer
. This way, only syntactic units within the same level in the
parse tree are accepted both in the source and the target languages. A
Dictionary
is used to translate entities, which are then inflected
through a Generator
.
Constructor and Description |
---|
DefaultTranslator(BilingualCorpus corpus,
Analyzer analyzer,
boolean sentencePerLine,
Dictionary dictionary,
Generator generator,
boolean tokenize,
int minTokens)
Constructs a new translator.
|
Modifier and Type | Method and Description |
---|---|
void |
translate(java.io.Reader in,
TranslationWriter out)
Creates a partial translation for the given input text.
|
public DefaultTranslator(BilingualCorpus corpus, Analyzer analyzer, boolean sentencePerLine, Dictionary dictionary, Generator generator, boolean tokenize, int minTokens)
corpus
- the BilingualCorpus
in which to look for translations.analyzer
- the Analyzer
with which to analyze the input text.sentencePerLine
- whether the input text will have a single sentence per line or not. If false
, the analyzer will try to split each line into sentences by itself, but it might still decide that it consists of a single one.dictionary
- the Dictionary
with which to translate entities.generator
- the Generator
with which to inflect the translated entities.tokenize
- whether the partially translated output text should be tokenized or not.minTokens
- the minimum amount of contiguous tokens for which to look for partial translations.public void translate(java.io.Reader in, TranslationWriter out)
Translator
translate
in interface Translator
in
- the Reader
to read the input from.out
- the TranslationWriter
with which to write the output.