Exemplo n.º 1
0
    def __init__(self, threshold, manual_fn):
        Filter.__init__(self)
        
        self.appl_only_filter = ApplicationModeAnnotator(threshold)
        self.null_only_filter = NullModeAnnotator(threshold)

        self.manual_fn = manual_fn
Exemplo n.º 2
0
    def __init__(self, outdir, format):
        Filter.__init__(self)
        OutputDerivation.__init__(self,
                                  transformer=self.transformer,
                                  outdir=outdir)

        self.format_string = self.make_format_string_from(format)
Exemplo n.º 3
0
 def __init__(self, substs, output_dir):
     # substs maps from the _name_ of each old category to its replacement category _object_.
     Filter.__init__(self)
     DerivationOutput.__init__(self)
     
     self.substs = substs
     self.output_dir = output_dir
Exemplo n.º 4
0
    def __init__(self, expression):
        Filter.__init__(self)
        initialise()

        self.expression = expression

        self.nmatched = self.total = 0
Exemplo n.º 5
0
    def __init__(self, outdir):
        Filter.__init__(self)
        OutputPrefacedPTBDerivation.__init__(self, outdir)

        self.outdir = outdir
        self.bad = OutputPrefacedPTBDerivation(os.path.join(outdir, 'failed'))
        self.bad_freqs = defaultdict(int)
Exemplo n.º 6
0
    def __init__(self, outdir):
        Filter.__init__(self)
        OutputPrefacedPTBDerivation.__init__(self, outdir)

        self.outdir = outdir
        self.bad = OutputPrefacedPTBDerivation(os.path.join(outdir, 'failed'))
        self.bad_freqs = defaultdict(int)
Exemplo n.º 7
0
 def __init__(self, expression):
     Filter.__init__(self)
     initialise()
     
     self.expression = expression
     self.count = 0
     self.total = 0
Exemplo n.º 8
0
 def __init__(self, expression):
     Filter.__init__(self)
     initialise()
     
     self.expression = expression
     
     self.nmatched = self.total = 0
Exemplo n.º 9
0
    def __init__(self, expression):
        Filter.__init__(self)
        initialise()

        self.expression = expression
        self.count = 0
        self.total = 0
Exemplo n.º 10
0
    def __init__(self, threshold, manual_fn):
        Filter.__init__(self)

        self.appl_only_filter = ApplicationModeAnnotator(threshold)
        self.null_only_filter = NullModeAnnotator(threshold)

        self.manual_fn = manual_fn
Exemplo n.º 11
0
 def __init__(self, anno_filename, output_dir):
     Filter.__init__(self)
     
     self.anno_filename = anno_filename
     self.substs = self.process_annotator_into_substs(anno_filename)
     self.output_dir = output_dir
     
     self.filter = Subst(self.substs, self.output_dir)
Exemplo n.º 12
0
 def __init__(self, output_dir, extension):
     Filter.__init__(self)
     self.output_dir = output_dir
     self.extension = extension
     
     try:
         os.mkdir(self.output_dir)
     except OSError: pass
Exemplo n.º 13
0
    def __init__(self):
        Filter.__init__(self)

        self.counts = defaultdict(lambda: 0)
        self.adjunction_kinds = defaultdict(lambda: 0)
        self.predication_kinds = defaultdict(lambda: 0)
        self.apposition_kinds = defaultdict(lambda: 0)
        self.modification_kinds = defaultdict(lambda: 0)
        self.coordination_kinds = defaultdict(lambda: 0)
Exemplo n.º 14
0
    def __init__(self, output_dir, extension):
        Filter.__init__(self)
        self.output_dir = output_dir
        self.extension = extension

        try:
            os.mkdir(self.output_dir)
        except OSError:
            pass
Exemplo n.º 15
0
    def __init__(self):
        Filter.__init__(self)

        self.counts = defaultdict(lambda: 0)
        self.adjunction_kinds = defaultdict(lambda: 0)
        self.predication_kinds = defaultdict(lambda: 0)
        self.apposition_kinds = defaultdict(lambda: 0)
        self.modification_kinds = defaultdict(lambda: 0)
        self.coordination_kinds = defaultdict(lambda: 0)
Exemplo n.º 16
0
 def __init__(self):
     Filter.__init__(self)
     class D(object):
         def __init__(self):
             self.va = 0
             self.jj = 0
             self.va_examples = Counter()
             self.jj_examples = Counter()
             self.mixed_examples = Counter()
         def __repr__(self): return '<va:%d, jj:%d>' % (self.va, self.jj)
         
     self.counts = defaultdict(D)
Exemplo n.º 17
0
 def __init__(self):
     Filter.__init__(self)
     self.headfreqs = defaultdict(int)
Exemplo n.º 18
0
 def __init__(self):
     Filter.__init__(self)
     self.counter = CountDict()
Exemplo n.º 19
0
 def __init__(self):
     Filter.__init__(self)
     self.counts = defaultdict(int)
Exemplo n.º 20
0
 def __init__(self, outdir, format):
     Filter.__init__(self)
     OutputDerivation.__init__(self, transformer=self.transformer, outdir=outdir)
     
     self.format_string = self.make_format_string_from(format)
Exemplo n.º 21
0
 def __init__(self, lex):
     Filter.__init__(self)
     self.lex = lex
     self.cats_seen = set()
Exemplo n.º 22
0
 def __init__(self):
     Filter.__init__(self)
Exemplo n.º 23
0
 def __init__(self, lex):
     Filter.__init__(self)
     self.lex = lex
     self.cats_seen = set()
Exemplo n.º 24
0
 def __init__(self):
     Filter.__init__(self)
     self.words = []
Exemplo n.º 25
0
    def __init__(self, outdir):
        Filter.__init__(self)

        self.outdir = outdir
Exemplo n.º 26
0
 def __init__(self, indices):
     Filter.__init__(self)
     self.indices = set(map(int, indices.split(',')))
Exemplo n.º 27
0
 def __init__(self):
     Filter.__init__(self)
     self.n = 0
     self.total = 0
Exemplo n.º 28
0
 def __init__(self):
     Filter.__init__(self)
     self.total = 0
     self.l, self.r = 0, 0
     self.other = 0
Exemplo n.º 29
0
 def __init__(self):
     Filter.__init__(self)
     self.counts = defaultdict(int)
Exemplo n.º 30
0
 def __init__(self):
     Filter.__init__(self)
     self.conjs = defaultdict(lambda: defaultdict(int))
     self.inverse = defaultdict(lambda: defaultdict(int))
Exemplo n.º 31
0
 def __init__(self, outdir):
     Filter.__init__(self)
     OutputPrefacedPTBDerivation.__init__(self, outdir)
Exemplo n.º 32
0
 def __init__(self):
     Filter.__init__(self)
Exemplo n.º 33
0
 def __init__(self, outdir):
     Filter.__init__(self)
     self.nbad = 0
     self.nderivs = 0
Exemplo n.º 34
0
 def __init__(self):
     Filter.__init__(self)
     self.freqs = CountDict()
Exemplo n.º 35
0
 def __init__(self):
     Filter.__init__(self)
     self.counter = CountDict()
Exemplo n.º 36
0
 def __init__(self):
     Filter.__init__(self)
     self.n = 0
     self.total = 0
Exemplo n.º 37
0
 def __init__(self):
     Filter.__init__(self)
     self.atoms = set()
Exemplo n.º 38
0
 def __init__(self):
     Filter.__init__(self)
     self.depth = 0
     self.nderivs = 0
Exemplo n.º 39
0
 def __init__(self):
     Filter.__init__(self)
     self.total = 0
     self.l, self.r = 0, 0
     self.other = 0
Exemplo n.º 40
0
 def __init__(self):
     Filter.__init__(self)
     
     self.puncts = Counter()
Exemplo n.º 41
0
 def __init__(self):
     Filter.__init__(self)
     self.branches = 0
     self.internals = 0
Exemplo n.º 42
0
    def __init__(self):
        Filter.__init__(self)

        self.rcderivs = 0
        self.total = 0
        self.parents = defaultdict(int)
Exemplo n.º 43
0
 def __init__(self, outdir):
     Filter.__init__(self)
     OutputPrefacedPTBDerivation.__init__(self, outdir)
Exemplo n.º 44
0
 def __init__(self):
     Filter.__init__(self)
     self.branches = 0
     self.internals = 0
Exemplo n.º 45
0
    def __init__(self, outdir):
        Filter.__init__(self)

        self.outdir = outdir
Exemplo n.º 46
0
 def __init__(self):
     Filter.__init__(self)
     
     self.rcderivs = 0
     self.total = 0
     self.parents = defaultdict(int)
Exemplo n.º 47
0
 def __init__(self):
     Filter.__init__(self)
     self.examples = defaultdict(CountDict)
Exemplo n.º 48
0
 def __init__(self):
     Filter.__init__(self)
     self.atoms = set()
Exemplo n.º 49
0
 def __init__(self, indices):
     Filter.__init__(self)
     self.indices = set(map(int, indices.split(',')))
Exemplo n.º 50
0
 def __init__(self):
     Filter.__init__(self)
     self.words = []
Exemplo n.º 51
0
 def __init__(self):
     Filter.__init__(self)
     self.conjs = defaultdict(lambda: defaultdict(int))
     self.inverse = defaultdict(lambda: defaultdict(int))
Exemplo n.º 52
0
 def __init__(self, outdir):
     Filter.__init__(self)
     OutputDerivation.__init__(self, outdir, transformer=self.process, 
         fn_template=lambda bundle: "chtb_%02d%02d.parg" % (bundle.sec_no, bundle.doc_no),
         outdir_template=lambda outdir, bundle: "%s/%02d" % (outdir, bundle.sec_no))