]> git.mxchange.org Git - friendica.git/blobdiff - library/spam/b8/b8.php
Merge remote-tracking branch 'upstream/develop' into develop
[friendica.git] / library / spam / b8 / b8.php
index ea1e15ffadc13cee928835b2a16cbd3921213a69..28a3dd29f9baad93f408ee38a073992c74bfbc40 100644 (file)
@@ -205,7 +205,7 @@ class b8
         * @return float The rating between 0 (ham) and 1 (spam)
         */
 
-       public function classify($text)
+       public function classify($uid,$text)
        {
 
                # Validate the startup
@@ -217,7 +217,7 @@ class b8
 
                # 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
 
@@ -231,7 +231,7 @@ class b8
                        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)
 
@@ -441,9 +441,9 @@ class b8
         * @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);
        }
 
        /**
@@ -455,9 +455,9 @@ class b8
         * @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);
        }
 
        /**
@@ -470,7 +470,7 @@ class b8
         * @return void
         */
 
-       private function _process_text($text, $category, $action)
+       private function _process_text($text, $category, $action, $uid = 0)
        {
 
                # Validate the startup
@@ -494,7 +494,7 @@ class b8
                        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);
 
        }