提交 6b7d01ec 编写于 作者: W wangjiawei04

Merge branch 'jiawei/lac_sync' into jiawei/doc_test

......@@ -30,6 +30,3 @@ python lac_web_service.py jieba_server_model/ lac_workdir 9292
```
curl -H "Content-Type:application/json" -X POST -d '{"words": "我爱北京天安门", "fetch":["word_seg"]}' http://127.0.0.1:9292/lac/prediction
```
......@@ -30,6 +30,3 @@ python lac_web_service.py jieba_server_model/ lac_workdir 9292
```
curl -H "Content-Type:application/json" -X POST -d '{"words": "我爱北京天安门", "fetch":["word_seg"]}' http://127.0.0.1:9292/lac/prediction
```
......@@ -101,10 +101,8 @@ class LACReader(object):
return word_ids
def parse_result(self, words, crf_decode):
tags = [
self.id2label_dict[str(x)] for x in crf_decode
]
tags = [self.id2label_dict[str(x)] for x in crf_decode]
sent_out = []
tags_out = []
partial_word = ""
......@@ -119,10 +117,8 @@ class LACReader(object):
partial_word = words[ind]
continue
partial_word += words[ind]
if len(sent_out) < len(tags_out):
sent_out.append(partial_word)
return sent_out
......@@ -29,8 +29,7 @@ class LACService(WebService):
return {"words": feed_data}, fetch
def postprocess(self, feed={}, fetch=[], fetch_map={}):
segs = self.reader.parse_result(
feed["words"], fetch_map["crf_decode"])
segs = self.reader.parse_result(feed["words"], fetch_map["crf_decode"])
return {"word_seg": "|".join(segs)}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册