Skip to content

Latest commit

 

History

History
28 lines (22 loc) · 494 Bytes

README.md

File metadata and controls

28 lines (22 loc) · 494 Bytes

ac automaton

This package implements ac automaton algorithm for fast matching many patterns in string.

example

A simple use case:

package main

import (
"fmt"
"github.com/we-miks/ac_automaton"
)

func main() {
    patterns := []string{"i", "is", "his", "her", "hers", "she"}
    ac := ac_automaton.NewACAutomaton()
    for _, pattern := range patterns {
        ac.Insert(pattern)
    }
    ac.Build()
    s := "uthersheis"
    res := ac.FindMatches(s)
    fmt.Println(res)
}