I'm seeing a problem with the normalisation following authorname:
Van der Haegen, Guy

When normalised this comes out as
Van der der Haegen, G.
(The der part is repeated).

Strangely enough I also have this name in a field with another author name:
Crombé, Philippe ; Van der Haegen, Guy

This gets correctly normalised to:
Crombé, P.; Van der Haegen, G.

Also when the der part starts with a capital D it does work correctly:
Van Der Linden, Cyriel
becomes
Van Der Linden, C.

Comments

rjerome’s picture

I'm guessing that there is extra white space in the entry where the "der" is repeated. I'll try to put some code in to avoid this.

Ron.

Kador’s picture

I've checked the extra whitespace and it does seem to be the case. I've also located several more examples in our database. Apparently the same name sometimes triggers the behaviour and sometimes it doesn't, eg. "Van De Mosselaer, P." sometimes once becomes "Van De Mosselaer, P." and once it becomes "Van De De Mosselaer, P."

It has to do with leading whitespace, if there's whitespace before the "Van" part it works correctly, if there isn't it becomes "Van De De Mosselaer, P.". I think it explains why it works when there are multiple authors (where it's common to put extra whitespace after the semicolon. I believe the presence of whitespace in front of the lastname should not matter.

rjerome’s picture

Dealing with author names has to be one of the toughest issues. Although it may seem tivial on the surface, there are so many permiatations and combinations to deal with it gets ugly quick. I used to ignor the white space before the prefix, however this caused problems also, so I guess the answer is to test for both cases.

I'll see what I can do.

Ron.

Kador’s picture

Is there any reason to split the lastnames into prefixes and the actual lastname?
Does this have to do with some countries not ordering on the prefix but on the lastname, eg. In Belgium we order "Van Daele, K." under the V but I know in the Netherlands they order this name under the D as "Daele Van, K." (or something similiar).
I can understand this being a difficult subject and I appreciate your efforts. For my part I'd be okay with the biblio module leaving the entire lastname as it is and just normalising the first name (reducing it to it's initials if the entire name is present).

Koen

Kador’s picture

Is there any progress on this?

I checked the code for _bilbio_get_prefix and I think the problem is that the line:

if (strlen($prefix)) $name = str_replace($prefs, "", $name);

uses the prefs array that first strips out the first prefix rendering the second one invalid.
E.g if the name is "Van der Gucht",
first "Van " gets stripped so the test against " der " comes out negative and the der part is left behind.
This gives as prefix: "Van der" (correct)
But leaves the name as :"der Gucht"

I think adding "der " to the prefs array should fix this.

Kador’s picture

A better solution seems to be possible. If you replace

if (strlen($prefix)) $name = str_replace($prefs, "", $name);

by

if (strlen($prefix)) $name = str_replace($prefs, " ", $name);

Essentialy replacing prefixes by a space in stead of an empty string everything seems to work as it should. I tested this with an array of names containing no, one or two prefixes and it all works out fine.

Kador’s picture

Hello,

I've written a test-function to show the solution I proposed above. As you can see, changing "" to " " fixes the problem with multiple prefixes. Would it be possible to implement this. Right now I've manually altered the biblio.module file but I would have to apply the change anew with every biblio update.

Thanks.

Koen

<?php

function _biblio_get_prefix(&$name) {
  $prefix = null;
  $name = " " . $name;
  $prefs = array(" Van ", " van ", " von ", " den ", " der ", " de ", " De ", " ter
", " Ter ", "Vander ");
  if (strstr($name, " Van ")) $prefix .= "Van ";
  if (strstr($name, " van ")) $prefix .= "van ";
  if (strstr($name, " Vander ")) $prefix .= "Vander ";
  if (strstr($name, " von ")) $prefix .= "von ";
  if (strstr($name, " de ")) $prefix .= "de ";
  if (strstr($name, " De ")) $prefix .= "De ";
  if (strstr($name, " den ")) $prefix .= "den ";
  if (strstr($name, " der ")) $prefix .= "der ";
  if (strstr($name, " ter ")) $prefix .= "ter ";
  if (strstr($name, " Ter ")) $prefix .= "Ter ";
  if (strlen($prefix)) $name = str_replace($prefs, " ", $name);
  $name = trim($name);
  return $prefix;
}

$test = array ( 'Van der Gucht, Katrien', 'Meylemans, Erwin', 'Van Daele, Koen',
'Van der Linden, Geert', 'Roeder, Hans' );

foreach ( $test as $naam ) {
    echo 'Name before get prefix:' . $naam . "\n";    
    $prefix = _biblio_get_prefix( $naam );
    echo 'Prefix: ' . $prefix . "\n";
    echo 'Name:' . $naam . "\n";
}

?>
rjerome’s picture

Consider it done.

Ron.

bekasu’s picture

Status: Active » Closed (fixed)

Marking issue closed.