Exemplo n.º 1
0
func main() {
	dict, err := migemo.Load("./_dict")
	if err != nil {
		log.Fatal(err)
	}
	pat, err := migemo.Pattern(dict, "ai")
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("pattern=%s\n", pat)
}
Exemplo n.º 2
0
func main() {
	dict, err := migemo.Load("../dict")
	if err != nil {
		log.Fatal(err)
	}
	re, err := migemo.Compile(dict, "kensaku")
	if err != nil {
		log.Fatal(err)
	}
	if re.MatchString("検索") {
		fmt.Println(`"検索" is matched as "kensaku"`)
	} else {
		fmt.Println(`"検索" isn't matched as "kensaku"`)
	}
}