Location: PHPKode > scripts > PHP Text Classifier > php-text-classifier/category.php
<?php

include_once 'wordprob.php';

/*=======================================================================*/
/* PHPTextClassifier adalah sebuah modul yang digunakan untuk mengklasi- *
 * fikasi sebuah text menjadi sebuah kategori tertentu berdasarkan kate- *
 * gori yang diberikan oleh pengguna. Metode yang digunakan adalah dengan*
 * metode Naive Bayesian Classifier (NBC).						      *
 *************************************************************************
 * PHPTextClassifier adalah Open SOurce, jadi Anda bebas untuk           *
 * meng-oprek kode ini. Tetapi tidak untuk dikomer-                      *
 * silkan.                                                               *
 ************************G-P-L********************************************
 *                                                                       *
 *  This program is free software: you can redistribute it and/or modify *
 *  it under the terms of the GNU General Public License as published by *
 *  the Free Software Foundation, either version 3 of the License, or    *
 *  (at your option) any later version.                                  *
 *                                                                       *  
 *  This program is distributed in the hope that it will be useful,      *
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of       *
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
 *  GNU General Public License for more details.                         *
 *                                                                       *
 *  You should have received a copy of the GNU General Public License    *
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.*
 *                                                                       *
 *************************************************************************
 * Copyright 2008 Alfan Farizki Wicaksono [ITB]                          *
 *************************************************************************
 *************************************************************************/

class category
{
	var $jumWordInCategory;
	var $jumVocab;
	var $categoryProb;
	var $namaCat;
	var $wordProb;
	
	function category($nama)
	{
		$this->wordProb = new wordprob();
		$this->jumWordInCategory = 0;
		$this->categoryProb = 0.5;
		$this->namaCat = $nama;
	}
	
	function incJumWord($inc)
	{
		$this->jumWordInCategory += $inc;
	}
	
	function addWordProb($word, $prob)
	{
		$this->wordProb->addProb($word, $prob);
	}
}

?>
Return current item: PHP Text Classifier