This is a hierarchical phrase-based translation system built with cdec trained for German to English translations.
- cdec: http://www.cdec-decoder.org (cdec is a decoder, aligner, and learning framework for statistical machine translation and similar structured prediction models)
It is very easy to integrate it in existing systems (Python)
Translate a sentence:
>>> import rt >>> translator = rt.RealtimeTranslator('/demo-en-de/demo-en-de.d', tmpdir='/tmp', cache_size=5, norm=False) >>> translation = translator.translate('<English Sentence>', ctx_name=None)
Add data to models:
>>> translator.learn('Source sentence', 'Target sentence', ctx_name=None)
Save state to a file or standard out (None).
If passed a StringIO object, state lines will be written to the object, resulting in an in-memory representation of state that is useful for operations such as storing state in a database:
>>> translator.save_state(file_or_stringio=None, ctx_name=None)
Drop state, freeing system resources:
Load state from a file or standard in (None).
If passed a StringIO object, state lines will be read from its getvalue() method. For example, state could be read from a database, written to a StringIO object, and passed to load_state():
>>> translator.load_state(file_or_stringio=None, ctx_name=None)
- Based on this tutorial