Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

实体ID的生成 #18

Open
waltbai opened this issue Jan 26, 2018 · 2 comments
Open

实体ID的生成 #18

waltbai opened this issue Jan 26, 2018 · 2 comments

Comments

@waltbai
Copy link

waltbai commented Jan 26, 2018

我通过 http://iesl.cs.umass.edu/riedel/ecml/ 直接解析出的实体ID都是以/guid/开头,而NRE中处理出的实体id是以m.xxx开头,请问这两个id的对应关系是怎么得到的?

@wudapeng268
Copy link

wudapeng268 commented Mar 9, 2018

你好
你是怎么从 那个网址解析数据的,我用 java 解析 protocol 数据,下面是我的代码

package cc.refectorie.proj.relation.protobuf;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

import cc.refectorie.proj.relation.protobuf.DocumentProtos.Relation;

public class Main {
public static void main(String[] args) throws IOException {
//File file = new File("/home/wup/re_data/heldout_relations/trainPositive.pb");
FileInputStream fileInputStream = new FileInputStream("heldout_relations/testNegative.pb");
Relation relation=DocumentProtos.Relation.parseFrom(fileInputStream);
System.out.println(relation.getDestGuid());
}
}
但是编译运行后,回报这种错误
Exception in thread "main" com.google.protobuf.InvalidProtocolBufferException: Protocol message end-group tag did not match expected tag.
at com.google.protobuf.InvalidProtocolBufferException.invalidEndTag(InvalidProtocolBufferException.java:110)
at com.google.protobuf.CodedInputStream$StreamDecoder.checkLastTagWas(CodedInputStream.java:2128)
at com.google.protobuf.AbstractParser.parsePartialFrom(AbstractParser.java:223)
at com.google.protobuf.AbstractParser.parseFrom(AbstractParser.java:239)
at com.google.protobuf.AbstractParser.parseFrom(AbstractParser.java:244)
at com.google.protobuf.AbstractParser.parseFrom(AbstractParser.java:49)
at com.google.protobuf.GeneratedMessageV3.parseWithIOException(GeneratedMessageV3.java:311)
at cc.refectorie.proj.relation.protobuf.DocumentProtos$Relation.parseFrom(DocumentProtos.java:7693)
at cc.refectorie.proj.relation.protobuf.Main.main(Main.java:13)

而且当我读取trainPositive.pb 时,报的错误还不一样。
Exception in thread "main" com.google.protobuf.InvalidProtocolBufferException$InvalidWireTypeException: Protocol message tag had invalid wire type.
at com.google.protobuf.InvalidProtocolBufferException.invalidWireType(InvalidProtocolBufferException.java:115)
at com.google.protobuf.UnknownFieldSet$Builder.mergeFieldFrom(UnknownFieldSet.java:551)
at com.google.protobuf.GeneratedMessageV3.parseUnknownField(GeneratedMessageV3.java:293)
at cc.refectorie.proj.relation.protobuf.DocumentProtos$Relation.(DocumentProtos.java:6200)
at cc.refectorie.proj.relation.protobuf.DocumentProtos$Relation.(DocumentProtos.java:6132)
at cc.refectorie.proj.relation.protobuf.DocumentProtos$Relation$1.parsePartialFrom(DocumentProtos.java:8482)
at cc.refectorie.proj.relation.protobuf.DocumentProtos$Relation$1.parsePartialFrom(DocumentProtos.java:8476)
at com.google.protobuf.AbstractParser.parsePartialFrom(AbstractParser.java:221)
at com.google.protobuf.AbstractParser.parseFrom(AbstractParser.java:239)
at com.google.protobuf.AbstractParser.parseFrom(AbstractParser.java:244)
at com.google.protobuf.AbstractParser.parseFrom(AbstractParser.java:49)
at com.google.protobuf.GeneratedMessageV3.parseWithIOException(GeneratedMessageV3.java:311)
at cc.refectorie.proj.relation.protobuf.DocumentProtos$Relation.parseFrom(DocumentProtos.java:7693)
at cc.refectorie.proj.relation.protobuf.Main.main(Main.java:13)
你遇到过这种问题吗?
谢谢

@waltbai
Copy link
Author

waltbai commented Mar 25, 2018

Entity和Relation要通过parseDelimitedFrom方法解析

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants