scalanlp/chalk — pull request #22 by bethard (2013-07-26 23:56:34+00:00)
Title: Adds support for loading MASC annotations into a Slab (issue #19)

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.