-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathtranslation.txt
More file actions
25 lines (22 loc) · 761 Bytes
/
translation.txt
File metadata and controls
25 lines (22 loc) · 761 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
===============================
Translating Text with Babelfish
===============================
>>> from nltk.misc import babelfish
>>> babelfish.translate('cookbook', 'english', 'spanish')
'libro de cocina'
>>> babelfish.translate('libro de cocina', 'spanish', 'english')
'kitchen book'
>>> babelfish.translate('cookbook', 'english', 'german')
'Kochbuch'
>>> babelfish.translate('kochbuch', 'german', 'english')
'cook book'
>>> for text in babelfish.babelize('cookbook', 'english', 'spanish'):
... print text
...
cookbook
libro de cocina
kitchen book
libro de la cocina
book of the kitchen
>>> babelfish.available_languages
['Portuguese', 'Chinese', 'German', 'Japanese', 'French', 'Spanish', 'Russian', 'Greek', 'English', 'Korean', 'Italian']