Skip to content
/ shield Public

Bayesian text classifier with flexible tokenizers and storage backends for Go

License

Notifications You must be signed in to change notification settings

eaigner/shield

Folders and files

NameName
Last commit message
Last commit date

Latest commit

author
Erik Aigner
Apr 15, 2013
7e8e5f1 · Apr 15, 2013

History

32 Commits
Apr 11, 2013
Apr 10, 2013
Apr 10, 2013
Apr 15, 2013
Apr 11, 2013
Apr 11, 2013
Apr 11, 2013
Apr 12, 2013
Apr 14, 2013
Apr 12, 2013
Apr 12, 2013

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

No packages published