Subversion Repositories navi

Rev

Rev 251 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
247 muzer 1
#!/usr/bin/env python
2
#    This file is part of Tsim Apiak.
3
#
4
#    Tsim Apiak is free software: you can redistribute it and/or modify
5
#    it under the terms of the GNU General Public Licence as published by
6
#    the Free Software Foundation, either version 3 of the Licence, or
7
#    (at your option) any later version.
8
#
9
#    In addition to this, you must also comply with clause 4 of the
10
#    Apache Licence, version 2.0, concerning attribution. Where there
11
#    is a contradiction between the two licences, the GPL
12
#    takes preference.
13
#
14
#    Tsim Apiak is distributed in the hope that it will be useful,
15
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
16
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
#    GNU General Public License for more details.
18
#
19
#    You should have received a copy of the GNU General Public License
20
#    along with Tsim Apiak.  If not, see <http://www.gnu.org/licenses/>.
21
 
22
from tsimapiak import translate
23
import sys
24
 
25
for line in sys.stdin:
249 muzer 26
    try:
27
        line = line.decode("utf-8")
28
    except:
29
        line = line.decode("iso-8859-1")
250 muzer 30
    translated = []
284 muzer 31
    for word in translate.translatesent(line, "en"):
247 muzer 32
        translated.append(word["translated"])
251 muzer 33
    translated = " | ".join(translated)
247 muzer 34
    print translated
35