(findText string, dict []string, stopImmediately bool)
| 79 | } |
| 80 | |
| 81 | func AcSearch(findText string, dict []string, stopImmediately bool) (bool, []string) { |
| 82 | if len(dict) == 0 { |
| 83 | return false, nil |
| 84 | } |
| 85 | if len(findText) == 0 { |
| 86 | return false, nil |
| 87 | } |
| 88 | m := InitAc(dict) |
| 89 | if m == nil { |
| 90 | return false, nil |
| 91 | } |
| 92 | hits := m.MultiPatternSearch([]rune(findText), stopImmediately) |
| 93 | if len(hits) > 0 { |
| 94 | words := make([]string, 0) |
| 95 | for _, hit := range hits { |
| 96 | words = append(words, string(hit.Word)) |
| 97 | } |
| 98 | return true, words |
| 99 | } |
| 100 | return false, nil |
| 101 | } |
no test coverage detected