mimno/Mallet — pull request #13 by drevicko (2014-08-22 12:43:40+00:00)
Title: set alphabets from data or pipe when reading serialised instance list

If an InstanceList which doesn't have a pipe (ie: has a `Noop` pipe) is serialised and read back in then `getAlphabet()` returns `null`.

The problem is that `InstanceList.readObject()` doesn't explicitly setup the Alphabet. The `getAlphabet()` methods in `InstanceList` check if the Alphabets have been set, and if not, look for them in the pipe. Alphabets are normally set from instance alphabets when instances are `add()`'ed to the list. When a serialised `InstanceList` is read, the alphabets havn't been set by `add()`, and if the pipe has no alphabets, we have a problem!

This patch that works for me, but in hindsight it may be better to change the `getAlphabet()` methods to check for an `Alphabet` in the stored instances before looking in the pipe.