{"id":13411702,"url":"https://github.com/BlackRabbitt/mspm","last_synced_at":"2025-03-14T17:31:03.951Z","repository":{"id":57496799,"uuid":"133856386","full_name":"BlackRabbitt/mspm","owner":"BlackRabbitt","description":"Multi-String Pattern Matching Algorithm Using TrieNode","archived":false,"fork":false,"pushed_at":"2018-05-19T06:36:38.000Z","size":13,"stargazers_count":25,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-07-31T20:48:39.098Z","etag":null,"topics":["aho-corasick","golang","multi-search","search","trie"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BlackRabbitt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-05-17T18:59:44.000Z","updated_at":"2024-04-05T11:41:43.000Z","dependencies_parsed_at":"2022-09-03T02:30:45.375Z","dependency_job_id":null,"html_url":"https://github.com/BlackRabbitt/mspm","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/BlackRabbitt%2Fmspm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlackRabbitt%2Fmspm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlackRabbitt%2Fmspm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlackRabbitt%2Fmspm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BlackRabbitt","download_url":"https://codeload.github.com/BlackRabbitt/mspm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243618656,"owners_count":20320272,"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":["aho-corasick","golang","multi-search","search","trie"],"created_at":"2024-07-30T20:01:15.945Z","updated_at":"2025-03-14T17:31:03.546Z","avatar_url":"https://github.com/BlackRabbitt.png","language":"Go","funding_links":[],"categories":["Data Integration Frameworks","Data Structures and Algorithms","数据结构与算法","Data Structures","数据结构","数据结构`go语言实现的数据结构与算法`","Generators","Uncategorized"],"sub_categories":["Text Analysis","文本分析","Advanced Console UIs","标准 CLI"],"readme":"# Multi-String Pattern Matching algorithm.\n[![Go Report Card](https://goreportcard.com/badge/github.com/BlackRabbitt/mspm)](https://goreportcard.com/report/github.com/BlackRabbitt/mspm)\n[![GoDoc](https://godoc.org/github.com/BlackRabbitt/mspm?status.svg)](https://godoc.org/github.com/BlackRabbitt/mspm)\n\nThis implementation is inspired from [Aho-Corasick algorithm](https://en.wikipedia.org/wiki/Aho%E2%80%93Corasick_algorithm)\n\n## Getting Started\n```\nmodelA = mspm.NewModel(\"mspm_model_A\")\npatternsToSearch = strings.NewReader(words) // words is newline seperated list of words/keywords\n\n// build mspm model with patterns\nmodelA.Build(patternsToSearch)\n\ninputString := \"input document where the above pattern is searched for.\"\ndocument := strings.NewReader(inputString)\noutput, err := modelA.MultiTermMatch(document)\n\n// output ~= [{matched_word: n_count}, ..]\n```\n\n## Test Coverage\n* [trie package](https://gocover.io/github.com/blackrabbitt/mspm/ds/trie)\n* [mspm package](https://gocover.io/github.com/blackrabbitt/mspm/search)\n\n## TrieNode vs TrieHashNode benchmark\n```\n$ cd github.com/BlackRabbitt/mspm/ds/trie\n$ go test -bench=.\ngoos: darwin\ngoarch: amd64\npkg: github.com/BlackRabbitt/mspm/ds/trie\nBenchmarkTrieNodeInsert-4             500000          2582 ns/op\nBenchmarkTrieNodeSearch-4           10000000           205 ns/op\nBenchmarkTrieHashNodeInsert-4        1000000          1491 ns/op\nBenchmarkTrieHashNodeSearch-4       10000000           206 ns/op\nPASS\nok      github.com/BlackRabbitt/mspm/ds/trie\t8.795s\n```\n\n## Resources\n1. [Trie](https://en.wikipedia.org/wiki/Trie)\n2. [mspm](http://www.ijsrp.org/research_paper_jul2012/ijsrp-july-2012-101.pdf) - Multi-String Pattern Matching algorithm. Generally used for Information Retrieval.\n3. [Aho-Corasick algorithm](https://en.wikipedia.org/wiki/Aho%E2%80%93Corasick_algorithm)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBlackRabbitt%2Fmspm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FBlackRabbitt%2Fmspm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBlackRabbitt%2Fmspm/lists"}