wahmedswl / bots

Automatically exported from code.google.com/p/bots
0 stars 0 forks source link

add: more preprocessing #362

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
preprocessing works, but is somewhat heavy and limited.
this new option has 3 ways of working:
- on raw file (eg with regular expressions)
- on lexed records
- on tree of nodes (eg sort csv file)

All three work via syntax in grammar:
syntax = {
        'preprocess_nodes': sort_function,
        }
def sort_function(thisnode):
    thisnode.root.children.sort(key=lambda s: s.record.get('ORDERNUMMER'))

- on raw file:  preprocess_raw
- on lexed records: preprocess_lex
- on tree of nodes:  preprocess_nodes

Original issue reported on code.google.com by hjebb...@gmail.com on 19 May 2015 at 8:27