This repository has been archived by the owner on May 29, 2020. It is now read-only.
Adds support for loading MASC annotations into a Slab (issue #19) #22
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Here's a first draft of the code for loading MASC annotations into Slabs. I called the object MascSlab and put it into MascUtil, but I don't feel strongly at all about either the name or location. The various functions for loading Masc annotations are named to match the files the load from (e.g. "s", "seg", "penn", "ne"). My first intuition was to name them by the annotations they produce ("sentence", "partOfSpeech", etc.) but (1) there is more than one way of getting each type of annotation and (2) some files should probably produce more than one annotation at the same time (e.g. the "penn" file contains both part-of-speech tags and lemmas).
I was able to reuse some of the code in MascUtil, thanks!
(I did have to write something a bit different for named entities though, and you may want to review your named entity loading code. It looks like it's only getting one token for each named entity. Take a look at the use of groupBy in MascSlab.ne to see what I mean.)
I added a single MASC-annotated file to src/test/resources for testing. I assume there aren't any issues with that, but thought I should mention it just in case.