~jtv/corpusfiltergraph/cross-python

« back to all changes in this revision

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