Skip to content

Commit

Permalink
Merge pull request #13 from drevicko/fix-instancelist-serialisation
Browse files Browse the repository at this point in the history
set alphabets from data or pipe when reading serialised instance list
  • Loading branch information
mimno committed Dec 2, 2014
2 parents 2705baa + 9b89ffe commit eee3a6c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/cc/mallet/types/InstanceList.java
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,22 @@ private void readObject (ObjectInputStream in) throws IOException, ClassNotFound
int version = in.readInt ();
instWeights = (HashMap<Instance,Double>) 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
Expand Down

0 comments on commit eee3a6c

Please sign in to comment.