ahocorasick

package module
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2020 License: MIT Imports: 0 Imported by: 0

README

GoDoc Build Status Go Report Card

go-ahocorasick

Aho-Corasick algorithm implemented in Golang

Usage

ac := ahocorasick.New([]string{/*your strings here*/})
matches := ac.Match(/*your text here*/)

Documentation

Overview

Example (Bar_qux)
ac := New([]string{"bar", "qux"})
fmt.Println(ac.Match("bar qux"))
Output:

[0 1]

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AhoCorasick

type AhoCorasick interface {
	// Match returns all indices of strings that were found in the passed text
	Match(text string) []int
}

AhoCorasick is an interface that returns all matching strings in a text. Use New() to initialize a new AhoCorasick interface.

func New

func New(allStrings []string) AhoCorasick

New builds a new AhoCorasick interface

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL