Porters Stemming Algorithm

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Richard Hyett

    Porters Stemming Algorithm

    I dug out a PHP version of Porters Algorithm from
    :-http://www.tartarus.or g/~martin/PorterStemmer/php.txt

    Whenever I try and run it I'm getting the error
    "Wrong parameter count for join() "

    Can anyone guess what I am doing wrong, I haven't modified the class
    so I assume its the way I'm calling it.

    Richard


    ************* code to call class *************** ******
    <?php
    require("stemmi ng.inc");

    $string="compuT ing";
    $string=strtolo wer($string);
    echo $string;
    $stm=new stemming();
    $stm->reset();
    for($i=0;$i<str len($string);$i ++)
    $stm->add(substr($st ring,$i,1));

    $stm->stem(0);
    $stem = $stm->toString(); //stem of the string
    echo $stem;
    ?>
    *************** *** end code*********** *************** *
  • Andy Hassall

    #2
    Re: Porters Stemming Algorithm

    On 22 Jun 2004 09:11:11 -0700, rachyett@yahoo. co.uk (Richard Hyett) wrote:
    [color=blue]
    >I dug out a PHP version of Porters Algorithm from
    >:-http://www.tartarus.or g/~martin/PorterStemmer/php.txt
    >
    >Whenever I try and run it I'm getting the error
    >"Wrong parameter count for join() "
    >
    >Can anyone guess what I am doing wrong, I haven't modified the class
    >so I assume its the way I'm calling it.[/color]

    What version of PHP are you running? The URL you posted contains a
    single-parameter usage of join; join's second parameter is only optional from
    PHP 4.3.0 onwards. See the PHP manual.

    --
    Andy Hassall <andy@andyh.co. uk> / Space: disk usage analysis tool
    http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space

    Comment

    • Richard Hyett

      #3
      Re: Porters Stemming Algorithm


      "Andy Hassall" <andy@andyh.co. uk> wrote in message
      news:qjsgd09vhd f2fc7u53jbqkrv6 j94llhnd2@4ax.c om...[color=blue]
      > On 22 Jun 2004 09:11:11 -0700, rachyett@yahoo. co.uk (Richard Hyett) wrote:
      >[color=green]
      > >I dug out a PHP version of Porters Algorithm from
      > >:-http://www.tartarus.or g/~martin/PorterStemmer/php.txt
      > >
      > >Whenever I try and run it I'm getting the error
      > >"Wrong parameter count for join() "
      > >
      > >Can anyone guess what I am doing wrong, I haven't modified the class
      > >so I assume its the way I'm calling it.[/color]
      >
      > What version of PHP are you running? The URL you posted contains a
      > single-parameter usage of join; join's second parameter is only optional[/color]
      from[color=blue]
      > PHP 4.3.0 onwards. See the PHP manual.[/color]

      Thanks Andy, that helped me sort it out. I stuck in the 'glue' parameter ""
      rather than upgraded the PHP, the quickest option!

      Richard


      Comment

      Working...