diff --git a/python/examples/lac/lac_web_service.py b/python/examples/lac/lac_web_service.py index 4a58c6a43caea4045220546488226da121bfdc17..fe06224125ccc305df19dad0805d1e28563ed229 100644 --- a/python/examples/lac/lac_web_service.py +++ b/python/examples/lac/lac_web_service.py @@ -25,8 +25,14 @@ class LACService(WebService): if "words" not in feed: raise ("feed data error!") feed_data = self.reader.process(feed["words"]) + fetch = ["crf_decode"] return {"words": feed_data}, fetch + def postprocess(self, feed={}, fetch=[], fetch_map={}): + segs = self.reader.parse_result( + feed["words"], fetch_map["crf_decode"]) + return {"word_seg": "|".join(segs)} + lac_service = LACService(name="lac") lac_service.load_model_config(sys.argv[1])