Documentation ¶
Index ¶
- type LevelDBStore
- func (ls *LevelDBStore) AddClass(class string) (err error)
- func (ls *LevelDBStore) ClassWordCounts(class string, words []string) (mc map[string]int64, err error)
- func (ls *LevelDBStore) Classes() (a []string, err error)
- func (ls *LevelDBStore) Close() error
- func (ls *LevelDBStore) IncrementClassWordCounts(m map[string]map[string]int64) (err error)
- func (ls *LevelDBStore) Reset() (err error)
- func (ls *LevelDBStore) TotalClassWordCounts() (m map[string]int64, err error)
- type RedisStore
- func (rs *RedisStore) AddClass(class string) (err error)
- func (rs *RedisStore) ClassWordCounts(class string, words []string) (mc map[string]int64, err error)
- func (rs *RedisStore) Classes() (a []string, err error)
- func (rs *RedisStore) Close() error
- func (rs *RedisStore) IncrementClassWordCounts(m map[string]map[string]int64) (err error)
- func (rs *RedisStore) Reset() (err error)
- func (rs *RedisStore) TotalClassWordCounts() (m map[string]int64, err error)
- type Set
- type Shield
- type Store
- type Tokenizer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LevelDBStore ¶
type LevelDBStore struct {
// contains filtered or unexported fields
}
LevelDBStore store
func (*LevelDBStore) AddClass ¶
func (ls *LevelDBStore) AddClass(class string) (err error)
AddClass - add class
func (*LevelDBStore) ClassWordCounts ¶
func (ls *LevelDBStore) ClassWordCounts(class string, words []string) (mc map[string]int64, err error)
ClassWordCounts - count words by class
func (*LevelDBStore) Classes ¶
func (ls *LevelDBStore) Classes() (a []string, err error)
Classes - list classes
func (*LevelDBStore) IncrementClassWordCounts ¶
func (ls *LevelDBStore) IncrementClassWordCounts(m map[string]map[string]int64) (err error)
IncrementClassWordCounts - increment vals
func (*LevelDBStore) TotalClassWordCounts ¶
func (ls *LevelDBStore) TotalClassWordCounts() (m map[string]int64, err error)
TotalClassWordCounts - count words in classes
type RedisStore ¶
type RedisStore struct {
// contains filtered or unexported fields
}
RedisStore - store
func (*RedisStore) AddClass ¶
func (rs *RedisStore) AddClass(class string) (err error)
func (*RedisStore) ClassWordCounts ¶
func (*RedisStore) Classes ¶
func (rs *RedisStore) Classes() (a []string, err error)
func (*RedisStore) Close ¶
func (rs *RedisStore) Close() error
func (*RedisStore) IncrementClassWordCounts ¶
func (rs *RedisStore) IncrementClassWordCounts(m map[string]map[string]int64) (err error)
func (*RedisStore) Reset ¶
func (rs *RedisStore) Reset() (err error)
func (*RedisStore) TotalClassWordCounts ¶
func (rs *RedisStore) TotalClassWordCounts() (m map[string]int64, err error)
type Shield ¶
type Shield interface { // Learn learns a single document Learn(class, text string) (err error) // BulkLearn learns many documents at once BulkLearn(sets []Set) (err error) // Forget forgets the document in the specified class Forget(class, text string) (err error) // Score returns the scores for each class normalized from 0 to 1 Score(text string) (scores map[string]float64, err error) // Classify returns the class with the highest score Classify(text string) (c string, err error) // Reset clears the storage Reset() error // Destroy Destroy() }
Shield interface
type Store ¶
type Store interface { Classes() ([]string, error) AddClass(class string) error ClassWordCounts(class string, words []string) (mc map[string]int64, err error) IncrementClassWordCounts(m map[string]map[string]int64) error TotalClassWordCounts() (map[string]int64, error) Reset() error Close() error }
Store interface
func NewLevelDBStore ¶
NewLevelDBStore - new redis store
Source Files ¶
Click to show internal directories.
Click to hide internal directories.