Comments (2)
Entity和Relation要通过parseDelimitedFrom方法解析
from nre.
你好
你是怎么从 那个网址解析数据的,我用 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)
你遇到过这种问题吗?
谢谢
from nre.
Related Issues (20)
- 关于数据的问题 HOT 5
- How to select relation in Attention while Testing? HOT 13
- train.cpp: error: reference to 'end' is ambiguous HOT 5
- about the query vector HOT 2
- 关于P@N测试的一个问题 HOT 2
- am I missing something? HOT 1
- Would you like to share the trained model using the NYT datasets? HOT 1
- Word embeddings file HOT 3
- Calculate gradients and update parameters for CNN+ATT HOT 1
- 求教:ubuntu16.04 编译后,执行命令./test后,出现段错误 HOT 2
- A SEGV signal occurred in CNN+ATT/init.h: 71 HOT 2
- 数据集的问题
- How to train about my data?
- how to test in single CNN/PCNN
- 关于contextwise split
- 关于论文中的实验结果
- about weight diagonal matrix
- P@N
- about test.h in CNN+ATT HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nre.