记java重构python版bert-serving-client
背景 项目需要把bert-serving-client由python用java实现,因为java比python快一些,于是就开始了尝试 先上bert-as-service的github地址: https://github.com/hanxiao/bert-as-service 其中client的init.py文件地址: https://github.com/hanxiao/bert-as-service/blob/master/client/bert_serving/client/__init__.py 主要实现其中encode、fetch、fetchAll和encodeAsync 导包 bertClient主要用到zeroMq和json,前者用来提供和服务端的连接,后者格式化传输数据。两者pom依赖如下 <dependency> <groupId>org.zeromq</groupId> <artifactId>jeromq</artifactId> <version>0.5.1</version> </dependency> <!-- for the latest SNAPSHOT --> <dependency> <groupId>org.zeromq</groupId> <artifactId>jeromq</artifactId> <version>0.5.2