gpt4 book ai didi

java - 如何使用 illinois-edison 序列化/反序列化

转载 作者:行者123 更新时间:2023-11-30 11:18:51 26 4
gpt4 key购买 nike

我正在使用爱迪生 ( http://cogcomp.cs.illinois.edu/page/software_view/Edison )。我使用 curator 提取特征,并保存在 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)

最佳答案

尝试使用 EdisonSerializationHelper .这个类正是为你想做的而创建的。

关于java - 如何使用 illinois-edison 序列化/反序列化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23570644/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com