Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

sitanshunanda/shield

Repository files navigation

Shield is a bayesian text classifier with flexible tokenizer and backend store support

Currently implemented:

  • Redis backend
  • English tokenizer

Example

package main
import (
 "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)
 }
}

About

Bayesian text classifier with flexible tokenizers and storage backends for Go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors

Languages

  • Go 99.7%
  • Ruby 0.3%

AltStyle によって変換されたページ (->オリジナル) /