Documentation ¶
Index ¶
- func ArrayUnion(to, from []int) (concat []int)
- func BoolArrayCapUp(old []bool) (new []bool)
- func BuildAc(p []string) (acToReturn map[int]map[uint8]int, f map[int][]int, s []int)
- func BuildExtendedAc(p []string) (acToReturn map[int]map[uint8]int, f map[int][]int)
- func ComputeAlphabet(p []string) (s string)
- func ConstructTrie(p []string) (trie map[int]map[uint8]int, stateIsTerminal []bool, f map[int][]int)
- func Contains(s []int, e int) bool
- func CreateNewState(state int, at map[int]map[uint8]int)
- func CreateTransition(fromState int, overChar uint8, toState int, at map[int]map[uint8]int)
- func GetParent(state int, at map[int]map[uint8]int) (uint8, int)
- func GetTransition(fromState int, overChar uint8, at map[int]map[uint8]int) (toState int)
- func GetWord(begin, end int, t string) string
- func IntArrayCapUp(old []int) (new []int)
- func StateExists(state int, at map[int]map[uint8]int) bool
- type Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ArrayUnion ¶
ArrayUnion Concats two arrays of int's into one.
func BoolArrayCapUp ¶
BoolArrayCapUp Dynamically increases an array size of bool's by 1.
func BuildExtendedAc ¶
BuildExtendedAc Functions that builds extended Aho Corasick automaton.
func ComputeAlphabet ¶
ComputeAlphabet Function that returns string of all the possible characters in given patterns.
func ConstructTrie ¶
func ConstructTrie(p []string) (trie map[int]map[uint8]int, stateIsTerminal []bool, f map[int][]int)
ConstructTrie Function that constructs Trie as an automaton for a set of reversed & trimmed strings.
func CreateNewState ¶
CreateNewState Automaton function for creating a new state 'state'.
func CreateTransition ¶
CreateTransition Creates a transition for function σ(state,letter) = end.
func GetParent ¶
GetParent Function that finds the first previous state of a state and returns it. Used for trie where there is only one parent.
func GetTransition ¶
GetTransition Returns ending state for transition σ(fromState,overChar), '-1' if there is none.
func GetWord ¶
GetWord Function that returns word found in text 't' at position range 'begin' to 'end'.
func IntArrayCapUp ¶
IntArrayCapUp Dynamically increases an array size of int's by 1.
Types ¶
type Result ¶
type Result struct {
// contains filtered or unexported fields
}
Result structure to hold occurrences
func Advanced ¶
Advanced Function performing the Advanced Aho-Corasick algorithm. Finds and prints occurrences of each pattern.
func AhoCorasick ¶
AhoCorasick Function performing the Basic Aho-Corasick algorithm. Finds and prints occurrences of each pattern.