{"id":21712137,"url":"https://github.com/ofw/ahocorasick","last_synced_at":"2025-03-20T18:23:06.085Z","repository":{"id":57493801,"uuid":"127177665","full_name":"ofw/ahocorasick","owner":"ofw","description":"Thread safe Aho-Corasick string matching algorithm for golang","archived":false,"fork":false,"pushed_at":"2018-03-28T17:51:38.000Z","size":7,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-25T17:10:23.567Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ofw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-28T17:51:29.000Z","updated_at":"2025-01-07T12:44:59.000Z","dependencies_parsed_at":"2022-08-30T07:12:01.918Z","dependency_job_id":null,"html_url":"https://github.com/ofw/ahocorasick","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ofw%2Fahocorasick","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ofw%2Fahocorasick/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ofw%2Fahocorasick/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ofw%2Fahocorasick/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ofw","download_url":"https://codeload.github.com/ofw/ahocorasick/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244667335,"owners_count":20490421,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-25T23:34:31.591Z","updated_at":"2025-03-20T18:23:06.050Z","avatar_url":"https://github.com/ofw.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"## ⚡ Aho-Corasick Pattern Matching Algorithm ⚡\n\nAho-Corasick string matching algorithm for golang.\n\nThis if a fork of original https://github.com/gansidui/ahocorasick library which is not updated since 2014.\n\nKey improvements:\n* Thread safety for multiple calls to `Match` method 🌪️\n* Perfomance optimizations (about 5x speed and reduced allocations) 🏎:\n```\n    BenchmarkOriginal      1000000          1424 ns/op          64 B/op          4 allocs/op\n    BenchmarkOptimized     5000000           237 ns/op          35 B/op          2 allocs/op\n```\n* Fixed incorrect results with some test cases\n\nNow this package is even faster than https://github.com/cloudflare/ahocorasick:\n\n```\nBenchmarkOfw-4          \t 5000000\t       318 ns/op\t      16 B/op\t       2 allocs/op\nBenchmarkCloudflare-4   \t 3000000\t       455 ns/op\t     104 B/op\t       4 allocs/op\n```\n\n~~~ go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/ofw/ahocorasick\"\n)\n\nfunc main() {\n\tac := ahocorasick.NewMatcher()\n\n\tdictionary := []string{\"hello\", \"world\", \"世界\", \"google\", \"golang\", \"c++\", \"love\"}\n\n\tac.Build(dictionary)\n\n\tret := ac.Match(\"hello世界, hello google, i love golang!!!\")\n\n\tfor _, i := range ret {\n\t\tfmt.Println(dictionary[i])\n\t}\n}\n\n\n~~~\n\n## License\n\nMIT","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fofw%2Fahocorasick","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fofw%2Fahocorasick","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fofw%2Fahocorasick/lists"}