Apertium package in Python returns module not installed error after installing module

161 Views Asked by At

I'm trying to get the english to german translator from the apertium package to work, but it seems that even if the languages are downloaded and installed the translator cannot find them, returning a mode not installed error. Am I downloading the wrong module?

Code example

import apertium
apertium.installer.install_module("eng")
apertium.installer.install_module("deu")
apertium.installer.install_module("eng-deu")

#checking if other languages work:
t = apertium.Translator('eng', 'spa')
print(t.translate('cats'))

#checking if english to german works after installation
r = apertium.Translator('eng', 'deu')
print(r.translate('cats'))

Output

Gatos
---------------------------------------------------------------------------
ModeNotInstalled                          Traceback (most recent call last)
<ipython-input-44-821185672685> in <module>()
      3 
      4 r = apertium.Translator('eng', 'deu')
----> 5 r.translate('cats')

/usr/local/lib/python3.7/dist-packages/apertium/translation/__init__.py in translate(self, text, mark_unknown, formatting, deformat, reformat)
    159             pair = map(to_alpha3_code, [self.l1, self.l2])
    160         else:
--> 161             raise apertium.ModeNotInstalled()
    162 
    163         if pair is not None:

ModeNotInstalled: 
0

There are 0 best solutions below