Skip to content
/ acor Public

ACOR means Aho-Corasick automation working On Redis, Written in Go

License

Notifications You must be signed in to change notification settings

skyoo2003/acor

Repository files navigation

ACOR

ACOR means Aho-Corasick automation working On Redis, Written in Go

Current Release CI Status Go Reference Go Report Card License

Prerequisites

  • Golang >= 1.13
  • Redis >= 3.0

Getting Started

$ go get -u https://github.com/skyoo2003/acor
package main

import (
	"fmt"
	"github.com/skyoo2003/acor/pkg/acor"
)

func main() {
	args := &acor.AhoCorasickArgs{
		Addr:     "localhost:6379",
		Password: "",
		DB:       0,
		Name:     "sample",
	}
	ac := acor.Create(args)
	defer ac.Close()

	keywords := []string{"he", "her", "him"}
	for _, k := range keywords {
		ac.Add(k)
	}

	matched := ac.Find("he is him")
	fmt.Println(matched)

	ac.Flush() // If you want to remove all of data
}

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

Copyright (c) 2016-2021 Sung-Kyu Yoo.

This project is MIT license.