Using Flask
export jieba
/SnowNLP
/pkuseg
as http API web service.
- python 3.7 (
$ brew install python3
) - pipenv (
$ brew install pipenv
)
- clone it
$ git clone https://github.com/jk195417/chinese-segmentation-as-service.git
$ cd chinese-segmentation-as-service
$ pipenv update
$ pipenv run python app.py
, serve on http://localhost:3001$ curl -X POST -H "Content-Type: application/json" -d '{"text" : "要斷詞的文字"}' "http://localhost:3001/segmentations"
or$ curl -X POST -H "Content-Type: application/json" -d '{"text" : ["要斷詞的句子1", "要斷詞的句子2"]}' "http://localhost:3001/segmentations"