Skip to content

Replacements in LASSY files #27

Description

@JeltevanBoheemen

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:

  • search specifies attribute-value pairs that should produce the nodes on which to apply the other operations. In case of multiple, all should apply.

  • remove specifies attributes that should be discarded

  • keep_only is the opposite of remove, only keep these attributes

  • edit replaces the attribute with the new attribute-value pair

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions