Back to Hanlp

Golang RESTful API

docs/api/restful_golang.md

2.1.1834 B
Original Source

Golang RESTful API

Install

shell
go get -u github.com/hankcs/gohanlp@main

Quick Start

Obtain an auth from any compatible service provider like our free service, then initiate a HanLPClient and call its Parse interface.

java
package main

import (
	"fmt"
	"github.com/hankcs/gohanlp/hanlp"
)

func main() {
    client := hanlp.HanLPClient(hanlp.WithAuth("The auth you applied for")) // anonymous users can skip auth
    s, _ := client.Parse("In 2021, HanLPv2.1 delivers state-of-the-art multilingual NLP techniques to production environments.",hanlp.WithLanguage("mul"))
    fmt.Println(s)
}

Refer to our testcases and data format for more details.