Documentation ¶
Overview ¶
ikku is Ikku("一句") detector, Ikku is something like Japanese Haiku("俳句").
Inspired by r7kamura/ikku.
Example ¶
package main import ( "fmt" "github.com/ikawaha/kagome-dict/ipa" ikku "github.com/kurochan/ikku-go" ) func main() { r, err := ikku.NewReviewer(ipa.Dict()) if err != nil { panic(err) } // This is Haiku. fmt.Println(r.Find("古池や蛙飛び込む水の音")) // This contains Haiku. fmt.Println(r.Find("まさに古池や蛙飛び込む水の音ですね。")) // This is NOT Haiku. fmt.Println(r.Find("今日もいい天気だ。")) }
Output:
Example (Print) ¶
package main import ( "fmt" "github.com/ikawaha/kagome-dict/ipa" ikku "github.com/kurochan/ikku-go" ) func main() { r, err := ikku.NewReviewer(ipa.Dict()) if err != nil { panic(err) } song := r.Find("まさに古池や蛙飛び込む水の音ですね。") fmt.Println(song.String()) }
Output: 古池や蛙飛び込む水の音
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReviewerOptionExactly ¶
func ReviewerOptionExactly(exactly bool) reviewerOptionExactly
Requires exact match.
Example ¶
package main import ( "github.com/ikawaha/kagome-dict/ipa" ikku "github.com/kurochan/ikku-go" ) func main() { ikku.NewReviewer( ipa.Dict(), ikku.ReviewerOptionExactly(true), ) }
Output:
func ReviewerOptionRule ¶
func ReviewerOptionRule(rule []int) reviewerOptionRule
Customize count rule.
Example ¶
package main import ( "github.com/ikawaha/kagome-dict/ipa" ikku "github.com/kurochan/ikku-go" ) func main() { //nolint ikku.NewReviewer( ipa.Dict(), ikku.ReviewerOptionRule([]int{5, 7, 5, 7, 7}), ) }
Output:
Types ¶
type Reviewer ¶
type Reviewer struct {
// contains filtered or unexported fields
}
func NewReviewer ¶
func NewReviewer(dict *dict.Dict, opts ...ReviewerOption) (*Reviewer, error)
type ReviewerOption ¶
type ReviewerOption interface {
Apply(*reviewerOption)
}
Click to show internal directories.
Click to hide internal directories.