--- drigg_rss.module.back	2008-02-23 00:06:53.000000000 -0500
+++ drigg_rss.module	2008-02-24 15:25:30.000000000 -0500
@@ -61,6 +61,69 @@ function drigg_rss_admin_settings(){
     '#description' => t('A list of "candidate tags". If a story that comes from RSS has one of these keywords, it will be added as a "tag" to the story. This needs to be a straight list, no enters etc. <string>NO SPACES!</strong>'),
     '#default_value' => variable_get('drigg_rss_candidate_tags', ''),
   );
+  
+  $form['drigg_rss_autotags']=array(
+    '#type' => 'checkbox',
+    '#title' => t('Use auto tag feture'),
+    '#description' => t('check if you want to use auto taging'),
+    '#default_value' => variable_get('drigg_rss_autotags', FALSE),
+  );
+
+  $form['drigg_rss_autotags_min_word_length']=array(
+    '#type' => 'textfield',
+    '#title' => t('Min word length'),
+    '#description' => t('Minimum number of characters to be included in single words'),
+    '#default_value' => variable_get('drigg_rss_autotags_min_word_length', 5),
+  );
+
+  $form['drigg_rss_autotags_min_word_occur']=array(
+    '#type' => 'textfield',
+    '#title' => t('Min word occurance'),
+    '#description' => t('Minimum number of times a single word should appear to be included'),
+    '#default_value' => variable_get('drigg_rss_autotags_min_word_occur', 5),
+  );
+
+  $form['drigg_rss_autotags_min_2word_length']=array(
+    '#type' => 'textfield',
+    '#title' => t('Min word length'),
+    '#description' => t('Minimum number of characters to be included in two word phrases'),
+    '#default_value' => variable_get('drigg_rss_autotags_min_2word_length', 5),
+  );
+
+  $form['drigg_rss_autotags_min_2words_phrase_length']=array(
+    '#type' => 'textfield',
+    '#title' => t('Min phrase length'),
+    '#description' => t('Minimum number of characters of a two word phrase should have'),
+    '#default_value' => variable_get('drigg_rss_autotags_min_2words_phrase_length', 10),
+  );
+
+  $form['drigg_rss_autotags_min_2word_occur']=array(
+    '#type' => 'textfield',
+    '#title' => t('Min word occurance'),
+    '#description' => t('Minimum number of times a two word phrase should appear to be included'),
+    '#default_value' => variable_get('drigg_rss_autotags_min_2word_occur', 5),
+  );
+
+  $form['drigg_rss_autotags_min_3word_length']=array(
+    '#type' => 'textfield',
+    '#title' => t('Min word length'),
+    '#description' => t('Minimum number of characters to be included in three word phrases'),
+    '#default_value' => variable_get('drigg_rss_autotags_min_3word_length', 5),
+  );
+
+  $form['drigg_rss_autotags_min_3words_phrase_length']=array(
+    '#type' => 'textfield',
+    '#title' => t('Min phrase length'),
+    '#description' => t('Minimum number of characters of a three word phrase should have'),
+    '#default_value' => variable_get('drigg_rss_autotags_min_3words_phrase_length', 10),
+  );  
+
+  $form['drigg_rss_autotags_min_3word_occur']=array(
+    '#type' => 'textfield',
+    '#title' => t('Min word occurance'),
+    '#description' => t('Minimum number of times a three word phrase should appear to be included'),
+    '#default_value' => variable_get('drigg_rss_autotags_min_3word_occur', 5),
+  );
 
   return system_settings_form($form);
 }
@@ -312,8 +375,38 @@ function drigg_rss_add_item( & $item ){
   $str= preg_replace('/[^a-zA-Z0-9 ]/',' ',strtolower(strip_tags($item->description . ' '. $item->title  )));
   $description_a=array_filter(explode(' ', $str ));
   $extra_tags=implode(',',array_intersect($item->candidate_tags_a , $description_a));
-
   $taxonomy['tags'][ $drigg_tag_vid ] .= ',' . $extra_tags;
+  //patch to add auto tag functionality
+  if(variable_get('drigg_rss_autotags',''))
+  {
+  	//this the actual application.
+	require_once 'class.autokeyword.php';
+  	$params['content']=$str;
+  	//set the length of keywords you like
+	$params['min_word_length'] = variable_get('drigg_rss_autotags_min_word_length','');  //minimum length of single words
+	$params['min_word_occur'] = variable_get('drigg_rss_autotags_min_word_occur','');  //minimum occur of single words
+
+	$params['min_2words_length'] = variable_get('drigg_rss_autotags_min_2word_length','');  //minimum length of words for 2 word phrases
+	$params['min_2words_phrase_length'] = drigg_rss_autotags_min_2words_phrase_length; //minimum length of 2 word phrases
+	$params['min_2words_phrase_occur'] = variable_get('drigg_rss_autotags_min_2word_occur',''); //minimum occur of 2 words phrase
+
+	$params['min_3words_length'] = variable_get('drigg_rss_autotags_min_3word_length','');  //minimum length of words for 3 word phrases
+	$params['min_3words_phrase_length'] = drigg_rss_autotags_min_3words_phrase_length; //minimum length of 3 word phrases
+	$params['min_3words_phrase_occur'] = variable_get('drigg_rss_autotags_min_3word_occur',''); //minimum occur of 3 words phrase
+
+	$keyword = new autokeyword1($params, "iso-8859-1");
+	$temp1=$keyword->parse_words();
+	$temp2=$keyword->parse_2words();
+	$temp3=$keyword->parse_3words();
+	if(!is_null($temp1))
+		$taxonomy['tags'][ $drigg_tag_vid ] .= ',' . $temp1;
+        if(!is_null($temp2))
+                $taxonomy['tags'][ $drigg_tag_vid ] .= ',' . $temp2;
+        if(!is_null($temp3))
+                $taxonomy['tags'][ $drigg_tag_vid ] .= ',' . $temp3;	
+  }
+  
+  
 
   // Create the node
   $new_vote = new stdClass();
