gpt4 book ai didi

java - 将一个语料库中的带注释文档添加到另一个语料库中

转载 作者:行者123 更新时间:2023-12-02 04:27:35 27 4
gpt4 key购买 nike

我想将一个语料库中的文档添加到另一个语料库或合并两个语料库。我怎样才能做到这一点?

最佳答案

好的。我从here找到了这个答案.

for(int i = 0; i < corpus2.size(); i++) {
Document doc = corpus2.get(i);
// remove corpus2's reference to loaded doc, but don't sync
corpus2.unloadDocument(i, false);
// "un-adopt" doc from old datastore
doc.setDataStore(null);
doc.setLRPersistenceId(null);
// and save it into the new one
luceneDataStore.adopt(doc);
luceneDataStore.sync(doc);
// add to the corpus
corpus1.add(doc);
// now we can unload properly
corpus1.unloadDocument(doc);
Factory.deleteResource(doc);
}
luceneDataStore.sync(corpus1);

无论如何,谢谢。

关于java - 将一个语料库中的带注释文档添加到另一个语料库中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31932463/

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