diff --git a/src/cc/mallet/types/InstanceList.java b/src/cc/mallet/types/InstanceList.java index d4aa0e010..9de5ef9f2 100644 --- a/src/cc/mallet/types/InstanceList.java +++ b/src/cc/mallet/types/InstanceList.java @@ -831,6 +831,22 @@ private void readObject (ObjectInputStream in) throws IOException, ClassNotFound int version = in.readInt (); instWeights = (HashMap) in.readObject(); pipe = (Pipe) in.readObject(); + if (dataAlphabet == null) { + if (size()>0) { + Instance instance = get(0); + dataAlphabet = instance.getDataAlphabet (); + } else if (pipe.getDataAlphabet()!=null) { + dataAlphabet = pipe.getDataAlphabet (); + } + } + if (targetAlphabet == null) { + if (size()>0) { + Instance instance = get(0); + targetAlphabet = instance.getTargetAlphabet (); + } else if (pipe.getTargetAlphabet()!=null) { + targetAlphabet = pipe.getTargetAlphabet (); + } + } } // added - culotta@cs.umass.edu