Documentation ¶
Index ¶
Constants ¶
View Source
const ( Good bayesian.Class = "Good" Bad bayesian.Class = "Bad" )
分類するクラス一覧
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BayesClassifier ¶
type BayesClassifier struct {
Classifier *bayesian.Classifier
}
BayesClassifier はナイーブベイズのモデルです
func GenerateBayesModel ¶
func GenerateBayesModel(r RSS) (*BayesClassifier, error)
GenerateBayesModel はRSSからナイーブベイズのモデルを生成します。
func LoadBayesModel ¶
func LoadBayesModel(filename string) (*BayesClassifier, error)
LoadBayesModel はファイルからモデルをロードします
func (BayesClassifier) Classify ¶
func (b BayesClassifier) Classify(words *[]string) (string, error)
func (BayesClassifier) Status ¶ added in v0.0.4
func (b BayesClassifier) Status() *BayesStatus
Status returns the result of learned status
func (BayesClassifier) Store ¶
func (b BayesClassifier) Store(filename string) error
Store はナイーブベイズのモデルを保存します
type BayesStatus ¶ added in v0.0.4
type BayesStatus struct { LearnedCount int `json:"learned_count,omitempty"` WordsByClasses []WordsByClass `json:"words_by_classes,omitempty"` }
BayesStatus stores the result of learned status
type RSS ¶
type RSS struct { Title string `json:"title,omitempty"` Entries *[]RSSEntry `json:"entries,omitempty"` }
RSS はRSS全体を示します
func CreateRSSFromURL ¶ added in v0.0.3
CreateRSSFromURL は指定されたURLからRSSを生成します。
func (RSS) Classify ¶
func (r RSS) Classify(classifier *BayesClassifier) error
Classify は未分類の記事を分類します
type RSSEntry ¶
type RSSEntry struct { Title string `json:"title,omitempty"` Description string `json:"description,omitempty"` Link string `json:"link"` Published time.Time `json:"published"` Categories []string `json:"categories,omitempty"` Retrieved time.Time `json:"retrieved,omitempty"` Reputation string `json:"reputation,omitempty"` }
RSSEntry はRSSの特定の記事を示します
type StorageJSON ¶
type StorageJSON struct {
FileName string
}
StorageJSON はStorageを実装し、JSONによりRSSを保存します。
func (StorageJSON) StoreUnique ¶
func (j StorageJSON) StoreUnique(rss *RSS) error
StoreUnique はRSSと既に保存済みのファイルを比較し、新たに追加されたものを追記します
type WordScore ¶ added in v0.0.4
type WordScore struct { Word string `json:"word,omitempty"` Score float64 `json:"score,omitempty"` }
WordScore stores set of word and score
type WordsByClass ¶ added in v0.0.4
type WordsByClass struct { ClassName string `json:"class_name,omitempty"` WordScores []WordScore `json:"word_scores,omitempty"` }
WordsByClass stores class name and list of scores words.
Click to show internal directories.
Click to hide internal directories.