Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eaigner/shield
Bayesian text classifier with flexible tokenizers and storage backends for Go
https://github.com/eaigner/shield
Last synced: 3 months ago
JSON representation
Bayesian text classifier with flexible tokenizers and storage backends for Go
- Host: GitHub
- URL: https://github.com/eaigner/shield
- Owner: eaigner
- License: mit
- Created: 2013-04-10T19:38:16.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2020-03-04T03:41:47.000Z (almost 5 years ago)
- Last Synced: 2024-07-31T20:52:16.554Z (5 months ago)
- Language: Go
- Homepage:
- Size: 220 KB
- Stars: 157
- Watchers: 12
- Forks: 33
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-go - shield - Bayesian text classifier with flexible tokenizers and storage backends for Go. (Machine Learning / Search and Analytic Databases)
- zero-alloc-awesome-go - shield - Bayesian text classifier with flexible tokenizers and storage backends for Go. (Machine Learning / Search and Analytic Databases)
- awesome-cobol - shield - Bayesian text classifier with flexible tokenizers and storage backends for Cobol (Machine Learning / Middlewares)
- awesome-go - shield - Bayesian text classifier with flexible tokenizers and storage backends for Go - ★ 118 (Machine Learning)
- awesome-go-extra - shield - 04-10T19:38:16Z|2020-03-04T03:41:47Z| (Machine Learning / Advanced Console UIs)
- awesome-go-zh - shield
README
Shield is a bayesian text classifier with flexible tokenizer and backend store support
Currently implemented:
- Redis backend
- English tokenizer## Example
```go
package mainimport (
"github.com/eaigner/shield"
)func main() {
sh := shield.New(
shield.NewEnglishTokenizer(),
shield.NewRedisStore("127.0.0.1:6379", "", 0),
)sh.Learn("good", "sunshine drugs love sex lobster sloth")
sh.Learn("bad", "fear death horror government zombie god")c, _ := sh.Classify("sloths are so cute i love them")
if c != "good" {
panic(c)
}c, _ = sh.Classify("i fear god and love the government")
if c != "bad" {
panic(c)
}
}
```