* @return float The rating between 0 (ham) and 1 (spam)
*/
- public function classify($text)
+ public function classify($uid,$text)
{
# Validate the startup
# Get the internal database variables, containing the number of ham and
# spam texts so the spam probability can be calculated in relation to them
- $internals = $this->_database->get_internals();
+ $internals = $this->_database->get_internals($uid);
# Calculate the spamminess of all tokens
return $tokens;
# Fetch all availible data for the token set from the database
- $this->_token_data = $this->_database->get(array_keys($tokens));
+ $this->_token_data = $this->_database->get(array_keys($tokens),$uid);
# Calculate the spamminess and importance for each token (or a degenerated form of it)
* @return void
*/
- public function learn($text, $category)
+ public function learn($text, $category, $uid)
{
- return $this->_process_text($text, $category, self::LEARN);
+ return $this->_process_text($text, $category, self::LEARN, $uid);
}
/**
* @return void
*/
- public function unlearn($text, $category)
+ public function unlearn($text, $category, $uid)
{
- return $this->_process_text($text, $category, self::UNLEARN);
+ return $this->_process_text($text, $category, self::UNLEARN, $uid);
}
/**
* @return void
*/
- private function _process_text($text, $category, $action)
+ private function _process_text($text, $category, $action, $uid = 0)
{
# Validate the startup
return $tokens;
# Pass the tokens and what to do with it to the storage backend
- return $this->_database->process_text($tokens, $category, $action);
+ return $this->_database->process_text($tokens, $category, $action, $uid);
}