简体   繁体   English

APERTIUM PYTHON:从西班牙语翻译成加泰罗尼亚语

[英]APERTIUM PYTHON: Translation from Spanish to Catalan

I am a complete newbie trying to use Apertium for translating Spanish short strings to Catalan, however I get the following warning:我是一个完整的新手,试图使用 Apertium 将西班牙语短字符串翻译成加泰罗尼亚语,但是我收到以下警告:

lt-proc: invalid option -- 'x'

I have read that that's common in the Python module and is not deeply worrying, however, the problem comes with the following minimal example:我读过这在 Python 模块中很常见,并不令人担忧,但是,问题来自以下最小示例:

import apertium
# apertium.installer.install_module("spa-cat")
t = apertium.Translator('spa', 'cat')
print(t.translate('Coche rojo.',mark_unknown=False))

That prints:打印:

^Cotxe/*Cotxe$ ^vermell/*vermell$.

Altough it seems to be translating ok ("Coche rojo" = "Cotxe vermell") I can't find why all those symbols are appearing and why the words are repeated.尽管它似乎可以翻译(“Coche rojo”=“Cotxe vermell”),但我找不到所有这些符号出现的原因以及这些词重复的原因。 This doesn't happen to me when I use other translation pairs such as English-Spanish.当我使用其他翻译对(例如英语-西班牙语)时,这不会发生在我身上。

I finally solved it doing the following:我终于通过以下方式解决了它:

sudo apt-get purge -y lttoolbox

And then re-installing all the languages via:然后通过以下方式重新安装所有语言:

import apertium
apertium.installer.install_module("spa")
apertium.installer.install_module("cat")
apertium.installer.install_module("spa-cat")

With this, both the warning and the inconvenient symbols went away.这样,警告和不便的符号都消失了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM