CentreForDigitalHumanities / CentreForDigitalHumanities/anncor-scripts
Replacements in LASSY files
- Dominant language
- Python
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
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
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.