Tłumaczenie maszynowe przy użyciu babelize_shell () w NLTK

Cześć Uczę się przetwarzania języka naturalnego za pomocą NLTK. Próbuję zaimplementować przykład książki babelize_shell (). To, co robię, to wykonywanie babelize_shell (), po czym wprowadzam mój ciąg, a następnie niemiecki, jak podano w książce, a następnie uruchamianie.

Błąd, który otrzymuję:

Traceback (most recent call last):
  File "<pyshell#148>", line 1, in <module>
    babelize_shell()
  File "C:\Python27\lib\site-packages\nltk\misc\babelfish.py", line 175, in babelize_shell
    for count, new_phrase in enumerate(babelize(phrase, 'english', language)):
  File "C:\Python27\lib\site-packages\nltk\misc\babelfish.py", line 126, in babelize
    phrase = translate(phrase, next, flip[next])
  File "C:\Python27\lib\site-packages\nltk\misc\babelfish.py", line 106, in translate
    if not match: raise BabelfishChangedError("Can't recognize translated string.")
BabelfishChangedError: Can't recognize translated string.

Oto przykładowa sesja:

>>> babelize_shell()
NLTK Babelizer: type 'help' for a list of commands.
Babel> how long before the next flight to Alice Springs?
Babel> german
Babel> run
0> how long before the next flight to Alice Springs?
1> wie lang vor dem folgenden Flug zu Alice Springs?
2> how long before the following flight to Alice jump?
3> wie lang vor dem folgenden Flug zu Alice springen Sie?
4> how long before the following flight to Alice do you jump?
5> wie lang, bevor der folgende Flug zu Alice tun, Sie springen?
6> how long, before the following flight to Alice does, do you jump?
7> wie lang bevor der folgende Flug zu Alice tut, tun Sie springen?
8> how long before the following flight to Alice does, do you jump?
9> wie lang, bevor der folgende Flug zu Alice tut, tun Sie springen?
10> how long, before the following flight does to Alice, do do you jump?
11> wie lang bevor der folgende Flug zu Alice tut, Sie tun Sprung?
12> how long before the following flight does leap to Alice, does you?

questionAnswers(1)

yourAnswerToTheQuestion