diff --git a/python/examples/lac/README.md b/python/examples/lac/README.md index 15dbd252f05f8c191ab14d879176fbd45e75f984..a0553b24ab377ed7d274583ed84827f2f1a985af 100644 --- a/python/examples/lac/README.md +++ b/python/examples/lac/README.md @@ -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 ``` - - - diff --git a/python/examples/lac/README_CN.md b/python/examples/lac/README_CN.md index 4ebeac4a55d0afa749246a7f8e10c62507f05506..98f2d36497dbf5dea8e34de355ae96a7f529349a 100644 --- a/python/examples/lac/README_CN.md +++ b/python/examples/lac/README_CN.md @@ -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 ``` - - - diff --git a/python/examples/lac/lac_reader.py b/python/examples/lac/lac_reader.py index 8094093a7a8a08ce3c72c4bc14101ddc6792c9ad..0c44177c2d56e5de94a18ce3514d0439a33361c5 100644 --- a/python/examples/lac/lac_reader.py +++ b/python/examples/lac/lac_reader.py @@ -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 - - diff --git a/python/examples/lac/lac_web_service.py b/python/examples/lac/lac_web_service.py index fe06224125ccc305df19dad0805d1e28563ed229..186d8badf8806606998466e3d1bb4047bf51b5d8 100644 --- a/python/examples/lac/lac_web_service.py +++ b/python/examples/lac/lac_web_service.py @@ -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)}