Giter Site home page Giter Site logo

ckipservice's Introduction

CKIP Service

Docker Hub

Web service for ckiplab/ckiptagger

Preparation

Start service

  1. Start the service using docker-compose
    docker-compose up -d
    
    If you want to rebuild the image, add --build flag when startup
    docker-compose up --build -d
    
  2. Service is now on port 5005

Stop service

  1. Stop the service using docker-compose
    docker-compose down
    

Endpoint

  • Main
    • method: POST
    • route: /
    • parameter
      • sentence_list: sentence list for CKIP tagging, split multiple sentences by linebreak(\n)

Test CKIP Tagger

  1. Send request using curl

    curl -X POST localhost:5005 -F $'sentence_list=土地公有政策??還是土地婆有政策。.\n最多容納59,000個人,或5.9萬人,再多就不行了.這是環評的結論.'
  2. Get the response like the following one

    JSON Response
    {
        "sentences": [
            {
                "segments": [
                    {
                        "word": "土地公有",
                        "pos": "VH"
                    },
                    {
                        "word": "政策",
                        "pos": "Na"
                    },
                    {
                        "word": "?",
                        "pos": "QUESTIONCATEGORY"
                    },
                    {
                        "word": "",
                        "pos": "QUESTIONCATEGORY"
                    },
                    {
                        "word": "還是",
                        "pos": "Caa"
                    },
                    {
                        "word": "土地",
                        "pos": "Na"
                    },
                    {
                        "word": "",
                        "pos": "Na"
                    },
                    {
                        "word": "",
                        "pos": "V_2"
                    },
                    {
                        "word": "政策",
                        "pos": "Na"
                    },
                    {
                        "word": "",
                        "pos": "PERIODCATEGORY"
                    },
                    {
                        "word": ".\\n",
                        "pos": "FW"
                    },
                    {
                        "word": "最多",
                        "pos": "Da"
                    },
                    {
                        "word": "容納",
                        "pos": "VJ"
                    },
                    {
                        "word": "59,000",
                        "pos": "Neu"
                    },
                    {
                        "word": "",
                        "pos": "Nf"
                    },
                    {
                        "word": "",
                        "pos": "Na"
                    },
                    {
                        "word": ",",
                        "pos": "COMMACATEGORY"
                    },
                    {
                        "word": "",
                        "pos": "Caa"
                    },
                    {
                        "word": "5.9萬",
                        "pos": "Neu"
                    },
                    {
                        "word": "",
                        "pos": "Na"
                    },
                    {
                        "word": ",",
                        "pos": "COMMACATEGORY"
                    },
                    {
                        "word": "",
                        "pos": "D"
                    },
                    {
                        "word": "",
                        "pos": "D"
                    },
                    {
                        "word": "",
                        "pos": "D"
                    },
                    {
                        "word": "不行",
                        "pos": "VH"
                    },
                    {
                        "word": "",
                        "pos": "T"
                    },
                    {
                        "word": ".",
                        "pos": "PERIODCATEGORY"
                    },
                    {
                        "word": "",
                        "pos": "Nep"
                    },
                    {
                        "word": "",
                        "pos": "SHI"
                    },
                    {
                        "word": "環評",
                        "pos": "Na"
                    },
                    {
                        "word": "",
                        "pos": "DE"
                    },
                    {
                        "word": "結論",
                        "pos": "Na"
                    },
                    {
                        "word": ".",
                        "pos": "PERIODCATEGORY"
                    }
                ],
                "entities": [
                    {
                        "word": "59,000",
                        "type": "CARDINAL",
                        "start": 24,
                        "end": 30
                    },
                    {
                        "word": "5.9萬",
                        "type": "CARDINAL",
                        "start": 34,
                        "end": 38
                    }
                ]
            }
        ]
    }

Alternative

If you want to run this service without Docker, you can follow this steps after data folder is ready.
However, we highly recommend using Docker Compose.

  1. Install required packages
    pip3 install -r requirements.txt
  2. Run
    uvicorn app.main:app --host=0.0.0.0 --port=5005

ckipservice's People

Contributors

johnroyer avatar jyhsu2000 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.