CVS edit link for Alex72RM

Hi,

I've written a new module (at now, version 5.x, but soon as possible I'll convert it to 6.x branch) that apply Porter stemmer algorithm to Italian language. I searched for something similar into Drupal repository, but no Italian version is yet there.
My module is based on a php class already written by another developer that released freely the code. So, I reused that code and implemented some hook function, similar as porter stemmer (for English, French and Spanish, as found into Drupal repository).

Alessandro Bonelli

Comments

alex72rm’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new11.01 KB

Hi,

I attached the 5.x version of my italian stemmer module.

avpaderno’s picture

Status: Needs review » Needs work
  1. The file LICENSE.txt needs to be removed; Drupal.org CVS doesn't allow to commit that file.
  2. It's not clear if the file stem.class.php is available from third-party sites. If it is, it needs to be removed, and users need information on where to download it; if it is not, then it needs to be rewritten to follow the Drupal coding standards.
alex72rm’s picture

Status: Needs work » Needs review
StatusFileSize
new5.04 KB

Hi again,

I have removed LICENSE.txt and applied some minor modification to code.

stem.class.php is a freely re-distributable class written by a colleague that asked me to cite his work.

I did it, as I imported class into .module code.

avpaderno’s picture

Status: Needs review » Needs work

See the Drupal coding standards to understand how a module code should be written.
The coding standards contain a section about the string functions that a module needs to use.

alex72rm’s picture

Status: Needs work » Needs review
StatusFileSize
new5.06 KB

Hi,

I have applied all the 'normal'-option code modification suggested by "coder" contributed module.

I hope it's the right direction...

avpaderno’s picture

Status: Needs review » Needs work

The module is supposed to use Drupal Unicode functions that handle multibyte strings; this means it should use drupal_strlen() rather than strlen(), etc.

avpaderno’s picture

    if ($str != $str_step_1) return $str_step_1;
    
    $str_len = strlen($str);
    
    if (count($ret_str = $this->delete_suff($this->suffissi_step_2, $str, $str_len, 'rv'))) return $ret_str;
    
    return $str;

The coding standards also report how to format code; the above code is not formatted as suggested.

alex72rm’s picture

StatusFileSize
new5.09 KB

Hi,

@#6: ok
@#7: I've applied some modifications, but I'm not sure to have accomplished the work as desired.

alex72rm’s picture

Status: Needs work » Needs review
alex72rm’s picture

Any news?

avpaderno’s picture

Status: Needs review » Needs work
    if (drupal_strlen($str)<2) 
		return '';//$str;

IF-statement should be written as

  if ($condition1) {
    // Instructions.
  }
  elseif ($condition2) {
    // Instructions.
  }
  else {
    // Instructions.
  }

Check also the indentation that in some cases seems to not be correct (for each indentation, you should add or remove two spaces).

alex72rm’s picture

Status: Needs work » Needs review
StatusFileSize
new5.05 KB

Hi again,

I've applied all your considerations concerning code style optimization.

I would ask if you prefer to check 6.x version too, before publishing attached 5.x version.

Thanks!

avpaderno’s picture

Status: Needs review » Fixed
      $pos_b = strpos($ante_suff, $ante_b, $ante_suff_len-drupal_strlen($ante_b));
      if ($pos_b !== FALSE) {
        return drupal_substr($str, 0, $pos+$str_len-$rv_len) .'e';
      }

The code should be use drupal_strpos(). There are some minor formatting issues (i.e., $ante_suff_len-drupal_strlen($ante_b) should be re-written as $ante_suff_len - drupal_strlen($ante_b); see the Drupal coding standards for more details).

    if ($ovunque) {

The variables should be named using English words; the same is true for the comments.

alex72rm’s picture

Hi again,

thanks for your review.

I'll go forth to improve the module.

A comment: drupal_strpos() doesn't exist.

avpaderno’s picture

A comment: drupal_strpos() doesn't exist.

That is true; I always get confused with drupal_substr().

Your application has been approved; you can start creating your project when you want.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

avpaderno’s picture

Component: Miscellaneous » new project application
Assigned: Unassigned » avpaderno
Issue summary: View changes
Status: Closed (fixed) » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.