standardizePunctuation($text, $lang); $thisTextWords = explode(' ',$thisText); $thisTextIndex = array(); $wordIndex = 0; $stemmer = new PaiceHuskStemmer(); for ($i=0; $i 1) && (!@in_array($word, $stoplist))) { $thisTextIndex[] = array('form'=>$form, 'stem'=>($stem ? $stemmer->Stem($word,$lang) : $word), 'index'=>$wordIndex); } $wordIndex = $wordIndex + strlen($word) + 1; // the last space } return array('original'=>$text, 'modified'=>$thisText, 'index'=>$thisTextIndex); } } ?>