/[drupal]/contributions/modules/porterstemmer/porterstemmer.module
ViewVC logotype

Diff of /contributions/modules/porterstemmer/porterstemmer.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.2.2.2, Thu Sep 10 14:50:28 2009 UTC revision 1.2.2.3, Thu Oct 8 16:22:10 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: porterstemmer.module,v 1.2.2.1 2009/08/26 19:22:49 jhodgdon Exp $  // $Id: porterstemmer.module,v 1.2.2.2 2009/09/10 14:50:28 jhodgdon Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 80  function porterstemmer_sbp_excerpt_match Line 80  function porterstemmer_sbp_excerpt_match
80    $newmatch = array();    $newmatch = array();
81    foreach ( $match as $item ) {    foreach ( $match as $item ) {
82      $pos = $match[0][1];      $pos = $match[0][1];
83        // Note: Do not use drupal_strlen/drupal_substr here! Need the real PHP
84        // string lengths/pos.
85      if (preg_match('/' . $boundary . '/iu', $text, $newmatch,      if (preg_match('/' . $boundary . '/iu', $text, $newmatch,
86          PREG_OFFSET_CAPTURE, $pos + strlen($key))) {          PREG_OFFSET_CAPTURE, $pos + strlen($key))) {
87        $keyfound = substr($text, $pos, $newmatch[0][1] - $pos);        $keyfound = substr($text, $pos, $newmatch[0][1] - $pos);
# Line 320  function porterstemmer_prestemming(&$wor Line 322  function porterstemmer_prestemming(&$wor
322    
323    // y -> Y if we should treat it as consonant    // y -> Y if we should treat it as consonant
324    $tmp = preg_replace('/^y/', 'Y', $tmp);    $tmp = preg_replace('/^y/', 'Y', $tmp);
325    $count = 1;    $before = 'not going to match';
326    while ( $count ) {    while ( $before != $tmp ) {
327      // Do this replacement one by one, to avoid unlikely yyyy issues      // Do this replacement one by one, to avoid unlikely yyyy issues
328        $before = $tmp;
329        // Note: do not use count param to preg_replace - added in 5.10!!
330      $tmp = preg_replace('/(' . PORTERSTEMMER_VOWEL . ')y/', '$1Y',      $tmp = preg_replace('/(' . PORTERSTEMMER_VOWEL . ')y/', '$1Y',
331        $tmp, 1, $count);        $tmp, 1);
332    }    }
333    
334    // This y/Y step should not have changed the word length    // This y/Y step should not have changed the word length

Legend:
Removed from v.1.2.2.2  
changed lines
  Added in v.1.2.2.3

  ViewVC Help
Powered by ViewVC 1.1.2