我正在使用爱迪生(http://cogcomp.cs.illinois.edu/page/software_view/Edison)。 我使用策展人提取功能,并保存在TextAnnotation文件中。 如何序列化/反序列化文件?当我直接尝试序列化它时,它会出错:
static List<RelInstance> allInstance = ...
ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(".../dataless_rel_srl/dataless-rel/Data/SemEval-2010"));
oos.writeObject(allInstances);
oos.close();
错误是:
java.io.NotSerializableException: edu.illinois.cs.cogcomp.edison.sentences.SymbolTable
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1180)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1528)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1493)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1528)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1493)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346)
at java.util.ArrayList.writeObject(ArrayList.java:710)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:975)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1480)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346)
at edu.illinois.cs.cogcomp.relationsDataless.SemEval2010Reader.saveAllOnDisk(SemEval2010Reader.java:203)
at edu.illinois.cs.cogcomp.relationsDataless.SemEval2010Reader.main(SemEval2010Reader.java:52)