~jtv/corpusfiltergraph/cross-python

« back to all changes in this revision

Viewing changes to trunk/lib/corpusfg/plugins/aligner-passthrough.py

  • Committer: tahoar
  • Date: 2012-05-02 15:46:23 UTC
  • Revision ID: svn-v4:bc069b21-dff4-4e29-a776-06a4e04bad4e::266
new layout. need to update code to use the new layout

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /usr/bin/env python
 
2
# -*- coding: utf8 -*-
 
3
 
 
4
#===============================================================================
 
5
# Author: Tom Hoar
 
6
#===============================================================================
 
7
 
 
8
#version:
 
9
#4.0.264 - version update
 
10
 
 
11
import os
 
12
import common as cf
 
13
 
 
14
class aligner(object):
 
15
 
 
16
        cfg = {
 
17
                'version': '4.0.264',
 
18
                }
 
19
        isopen = False
 
20
        p = object
 
21
        errors = []
 
22
 
 
23
        def open(self,parent,cfg):
 
24
                return
 
25
 
 
26
        def run(self,ktgt):
 
27
                '''run filter'''
 
28
                if ktgt[cf.rdrlang] == ktgt[cf.srclang]: return
 
29
                ksrc = list(ktgt)
 
30
                ksrc[cf.rdrlang] = ktgt[cf.srclang]
 
31
                ksrc = tuple(ksrc)
 
32
                self.p.cfoutput[ktgt]['tempbuff'] = ['\t'.join(['stdout',line]) for line in self.p.cfoutput[ktgt]['tempbuff']]
 
33
                self.p.cfoutput[ksrc]['tempbuff'] = ['\t'.join(['stdout',line]) for line in self.p.cfoutput[ksrc]['tempbuff']]
 
34
                self.p.cferror[ktgt]['tempbuff']  = ['\t'.join(['stderr',line]) for line in self.p.cfoutput[ktgt]['tempbuff']]
 
35
                self.p.cferror[ksrc]['tempbuff']  = ['\t'.join(['stderr',line]) for line in self.p.cfoutput[ksrc]['tempbuff']]
 
36
 
 
37
        def flush(self,ktgt):
 
38
                return
 
39
 
 
40
        def close(self):
 
41
                return
 
42
 
 
43
def usage():
 
44
        '''Command prompt help.'''
 
45
        return "\n%s\n\tUsage:\n\tfrom %s import filter\n"%(
 
46
        os.path.basename(sys.argv[0]),
 
47
        os.path.splitext(os.path.basename(sys.argv[0]))[0]
 
48
        )
 
49
 
 
50
licensetxt=u'''CorpusFiltergraph™ v4.0
 
51
Copyright © 2010-2012 Precision Translation Tools Co., Ltd.
 
52
 
 
53
This program is free software: you can redistribute it and/or modify
 
54
it under the terms of the GNU Lesser General Public License as published by
 
55
the Free Software Foundation, either version 3 of the License, or
 
56
(at your option) any later version.
 
57
 
 
58
This program is distributed in the hope that it will be useful,
 
59
but WITHOUT ANY WARRANTY; without even the implied warranty of
 
60
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
61
GNU Lesser General Public License for more details.
 
62
 
 
63
You should have received a copy of the GNU Lesser General Public License
 
64
along with this program.  If not, see http://www.gnu.org/licenses/.
 
65
 
 
66
For more information, please contact Precision Translation Tools Co., Ltd.
 
67
at: http://www.precisiontranslationtools.com'''
 
68
 
 
69
if __name__ == "__main__":
 
70
        import os
 
71
        import sys
 
72
        sys.stdout.write(usage().encode('utf8')+'\n')