UUDigitalHumanitieslab / AnnCor-scripts

A place for all the AnnCor scripts
MIT License
0 stars 0 forks source link

Replacements in LASSY files #27

Open JeltevanBoheemen opened 4 years ago

JeltevanBoheemen commented 4 years ago

In LASSY XML files (Alpino parses), make a script that replaces attribute-value pairs based on client-specified python dictionary.

Current dictionary: REPLACEMENTS = { 'eh': { 'search': {'lemma': 'eh', 'word': 'eh'}, 'remove': ['genus', 'getal', 'graad', 'naamval', 'ntype'], 'edit': {'postag': 'TSW()', 'pt': 'tsw', 'pos': 'tag'} }, 'uh': { 'search': {'lemma': 'eh', 'word': 'uh'}, 'remove': ['genus', 'getal', 'graad', 'naamval', 'ntype'], 'edit': {'postag': 'TSW()', 'pt': 'tsw', 'pos': 'tag'} }, 'xxx': { 'search': {'word': 'xxx'}, 'keep_only': ['begin', 'end', 'pos', 'root', 'postag', 'pt', 'lemma', 'word', 'sense', 'rel', 'id'], 'edit': {'pos': 'tag', 'postag': 'SPEC(onverst)', 'pt': 'spec', 'spectype': 'onverst'} }, 'yyy': { 'search': {'word': 'yyy'}, 'keep_only': ['begin', 'end', 'pos', 'root', 'postag', 'pt', 'lemma', 'word', 'sense', 'rel', 'id'], 'edit': {'pos': 'tag', 'postag': 'SPEC(onverst)', 'pt': 'spec', 'spectype': 'onverst'} }, 'NA()': { 'search': {'postag': 'NA()'}, 'edit': {'postag': 'TSW()', 'pt': 'tsw', 'pos': 'tag'} } }

Operations: