Index: related_block.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/related_block/related_block.module,v
retrieving revision 1.6
diff -u -r1.6 related_block.module
--- related_block.module	4 Mar 2008 16:23:36 -0000	1.6
+++ related_block.module	4 Mar 2008 16:48:44 -0000
@@ -191,13 +191,15 @@
 }
 
 function _related_block_strip($text, $important = false) {
+  $text = html_entity_decode($text, ENT_QUOTES, "UTF-8");
+  
   // strip all punctuation
   $wordlist = preg_split('/\s*[\s+\.|\?|,|(|)|\-+|\'|\"|=|;|&#0215;|\$|\/|:|{|}]\s*/i', strip_tags($text));
-  $a = array_count_values( $wordlist );
+  $a = array_count_values(array_filter($wordlist));
   
   // these are for english, it would be good to load the correct locale list for them.
   
-  $overusedwords = array( '', 'a', 'an', 'say', 'tell', 'and', 'it', 'his', 'her', 'he', 'no', 'is', 'this', 'that', 'said', 'so', 'what', 'the', 'and', 'of', 'i', 'to', 'is', 'in', 'with', 'for', 'as', 'that', 'on', 'at', 'this', 'my', 'was', 'our', 'it', 'you', 'we', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '10', 'about', 'after', 'all', 'almost', 'along', 'also', 'amp', 'another', 'any', 'are', 'area', 'around', 'available', 'back', 'be', 'because', 'been', 'being', 'best', 'better', 'big', 'bit', 'both', 'but', 'by', 'c', 'came', 'can', 'capable', 'control', 'could', 'course', 'd', 'dan', 'day', 'decided', 'did', 'didn', 'different', 'div', 'do', 'doesn', 'don', 'down', 'drive', 'e', 'each', 'easily', 'easy', 'edition', 'end', 'enough', 'even', 'every', 'example', 'few', 'find', 'first', 'found', 'from', 'get', 'go', 'going', 'good', 'got', 'gt', 'had', 'hard', 'has', 'have', 'he', 'her', 'here', 'how', 'if', 'into', 'isn', 'just', 'know', 'last', 'left', 'li', 'like', 'little', 'll', 'long', 'look', 'lot', 'lt', 'm', 'made', 'make', 'many', 'mb', 'me', 'menu', 'might', 'mm', 'more', 'most', 'much', 'name', 'nbsp', 'need', 'new', 'no', 'not', 'now', 'number', 'off', 'old', 'one', 'only', 'or', 'original', 'other', 'out', 'over', 'part', 'place', 'point', 'pretty', 'probably', 'problem', 'put', 'quite', 'quot', 'r', 're', 'really', 'results', 'right', 's', 'same', 'saw', 'see', 'set', 'several', 'she', 'sherree', 'should', 'since', 'size', 'small', 'so', 'some', 'something', 'special', 'still', 'stuff', 'such', 'sure', 'system', 't', 'take', 'than', 'their', 'them', 'then', 'there', 'these', 'they', 'thing', 'things', 'think', 'those', 'though', 'through', 'time', 'today', 'together', 'too', 'took', 'two', 'up', 'us', 'use', 'used', 'using', 've', 'very', 'want', 'way', 'well', 'went', 'were', 'what', 'when', 'where', 'which', 'while', 'white', 'who', 'will', 'would', 'your', 'mr');
+  $overusedwords = _related_block_overused();
   
   // Remove the stop words from the list.
   foreach ($overusedwords as $word) {
@@ -219,10 +221,26 @@
   // now reconstruct it without all the extras
   $s = '';
   foreach ($b as $word => $count) {
-    if ((($important) || ($count > 10)) && (strlen($word) > 2))
+    if (!is_numeric($word) && (($important) || ($count > 10)) && (strlen($word) > 2)) {
       $s .= str_repeat(' '. $word , $count);
+    }
   }
 
   return $s;
 }
 
+function _related_block_overused() {
+  global $locale;
+  $path = drupal_get_path('module', 'related_block') .'/ignore/';
+  
+  // get the locale file
+  if (is_file($path . $locale .'.inc')) {
+    include($path . $locale .'.inc');
+  }  
+  // otherwise use a default for english
+  else {
+    require($path . 'en.inc');
+  }
+  
+  return $words;
+}
