gothaiwordcut

package module
v0.0.0-...-02b1ebc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 18, 2022 License: MIT Imports: 6 Imported by: 0

README

go-thaiwordcut - Thai word segmentation in Golang

Codacy Badge

A simple Thai word segmentation written in Golang, based on Maximum Matching algorithm by S. Manabu . Uses Lexitron (by NECTEC) dictionary as default

Installation

go get github.com/narongdejsrn/go-thaiwordcut

Usage

import "github.com/narongdejsrn/go-thaiwordcut"

segmenter := gothaiwordcut.Wordcut()
segmenter.LoadDefaultDict()
result := segmenter.Segment("ทดสอบการตัดคำภาษาไทย")

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Segmenter)

Option : Option for Segmenter

type Segmenter

type Segmenter struct {
	Tree *radix.Tree
	// contains filtered or unexported fields
}

Segmenter : Segmenter main class

func Wordcut

func Wordcut(options ...Option) *Segmenter

Wordcut : main wordcut function

func (*Segmenter) LoadDefaultDict

func (w *Segmenter) LoadDefaultDict()

LoadDefaultDict : load dictionary into trie

func (*Segmenter) LoadDict

func (w *Segmenter) LoadDict(path string)

LoadDict : load dictionnary from path into trie

func (*Segmenter) LoadWords

func (w *Segmenter) LoadWords(words []string)

func (*Segmenter) Segment

func (w *Segmenter) Segment(txt string) []string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL