Thai word segmentation program in Go
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 4 commits ahead, 7 commits behind veer66:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
LICENSE
README.md
const.go
dict.go
dict_edge_builder.go
edge.go
edge_builder.go
mapkha.go
mapkha_test.go
pat_edge_builder.go
path_builder.go
prefixtree.go
prefixtree_test.go
tdict-std.txt
text_ranges.go
unk_edge_builder.go

README.md

Mapkha

Thai word segmentation (wordcut; word boundary identification; ตัดคำ) program in Go (golang)

Example

package main

import ("fmt"
    "strings"
    "bufio"
    "os"
    m "github.com/veer66/mapkha"
)

func check(e error) {
    if e != nil {
        panic(e)
    }
}

func main() {
    dict, e := m.LoadDefaultDict()
    check(e)
    wordcut := m.NewWordcut(dict)
    scanner := bufio.NewScanner(os.Stdin)
    for scanner.Scan() {
        fmt.Println(strings.Join(wordcut.Segment(scanner.Text()), "|"))
    }
}