Skip to content

Commit

Permalink
ignore
Browse files Browse the repository at this point in the history
  • Loading branch information
mattn committed Mar 31, 2023
1 parent 77470d2 commit bf668b6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions haiku.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 24,8 @@ func isEnd(c []string) bool {
return c[1] != "非自立" && !strings.HasPrefix(c[5], "連用") && c[5] != "未然形"
}

func isSpace(c []string) bool {
return c[0] == "空白"
func isIgnore(c []string) bool {
return len(c) > 0 && (c[0] == "空白" || c[0] == "補助記号")
}

// isWord return true when the kind of the word is possible to be leading of
Expand Down Expand Up @@ -89,7 89,7 @@ func MatchWithOpt(text string, rule []int, opt *Opt) bool {
var tmp []tokenizer.Token
for _, token := range tokens {
c := token.Features()
if len(c) > 0 && c[0] != "空白" {
if !isIgnore(c) {
tmp = append(tmp, token)
}
}
Expand Down Expand Up @@ -156,7 156,7 @@ func FindWithOpt(text string, rule []int, opt *Opt) ([]string, error) {
var tmp []tokenizer.Token
for _, token := range tokens {
c := token.Features()
if len(c) > 0 && c[0] != "空白" {
if !isIgnore(c) {
tmp = append(tmp, token)
}
}
Expand Down

0 comments on commit bf668b6

Please sign in to comment.