Code Monkey home page Code Monkey logo

golac's Introduction

golac

golac is a Golang wrapper for PaddleHub LAC.

Install

Download and install it:

go get github.com/vulcangz/golac

Make sure that you can run PaddleHub LAC on command line:

hub run lac --input_text "今天是个好日子"

Usage

A simple code for using golac is:

package main

import (
  "fmt"
	
  "github.com/vulcangz/golac" // exposes "golac"
)

func main() {
  text := `天气预报说今天要下雨`

  // LocalExec connector is responsible to run PaddleHub LAC process.
  c := golac.NewLocalExec(nil)
  c.Option = "--input_text"   // default option

  // LAC text
  doc, err := c.Run(text)
  if err != nil {
    fmt.Println(err.Error())
  }
  
  d, _ := golac.Decode(doc)
  for _, v := range d {
    for i := 0; i < len(v.Word); i++ {
      fmt.Printf("%s(%s) ", v.Word[i], v.Tag[i])
    }
  }
}

Output:

天气预报(n) 说(v) 今天(TIME) 要(v) 下雨(v)

LICENSE

MIT

golac's People

Stargazers

 avatar  avatar  avatar

Forkers

c93614

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.