- words := regexp_split_to_array(item.value, E'[,;()]');
- IF array_upper(words, 1) != 1 THEN
- FOR j IN 1..array_upper(words, 1) LOOP
- s := make_standard_name(words[j]);
- IF s != '' THEN
- w := getorcreate_word_id(s);
- IF w IS NOT NULL AND NOT (ARRAY[w] <@ result) THEN
- result := result || w;
- END IF;
+ -- consider parts before an opening braket a full word as well
+ words := regexp_split_to_array(value, E'[(]');
+ IF array_upper(words, 1) > 1 THEN
+ s := make_standard_name(words[1]);
+ IF s != '' THEN
+ w := getorcreate_name_id(s, words[1]);
+ IF w IS NOT NULL AND NOT (ARRAY[w] <@ result) THEN
+ result := result || w;