-
-
Notifications
You must be signed in to change notification settings - Fork 7
Machine Translation
Mika Hämäläinen edited this page Mar 8, 2019
·
8 revisions
UralicNLP provides functionality to connect to different translation services over their APIs. The main supported services are Apertium and Yandex
Translator objects have two methods get_languages() and translate(text, source, target). Get_languages gives a dictionary consisting of language codes of the supported languages. The keys indicate the supported source language and the values the supported target languages.
translator.get_languages()
>> {u'est': [u'est_estspell', u'est_estgram'], u'nob': [u'fao'], u'smn': [u'fin', u'sme'], u'fao': [u'nno', u'fao_faospell', u'fao_faogram', u'nob'], u'sme': [u'fin', u'sme_smespell', u'sma', u'sme_smegram', u'nob', u'smj', u'smn'], u'fin': [u'sme', u'smn', u'fin_fingram', u'fin_finspell'], u'sma': [u'sme', u'sma_smagram', u'nob', u'sma_smaspell'], u'smj': [u'nob', u'sme', u'smj_smjgram', u'smj_smjspell']}
from uralicNLP.translate import *
translator = ApertiumGiellateknoTranslator()
translator.translate("kissa juoksee kovaa", "fin","sme")
>> u"gáhttu viehká garrasa"
UralicNLP is an open-source Python library by Mika Hämäläinen