Posted on 2010-02-06 08:18:17.445036-08 by infotalk
Adding separator to keywords for languages
Hello!

Adding separator "|" to keywords for languages:

1. Example
The keyword list German/English alphabetic order now looks like this:
Altstadt, Architektur, aussen, architecture, exterior, old town
and should look like this with a separator:
Altstadt, Architektur, aussen, | architecture, exterior, old town

2. Example
The keyword list German/English alphabetic order now looks like this:
Altstadt, Backstein, brick, old town
and should look like this with a separator:
Altstadt, Backstein, | brick, old town

Thanks for the help in advance.
Direct Responses: 12329 | Write a response
Posted on 2010-02-06 12:35:52.469895-08 by exiftool in response to 12326
Re: Adding separator to keywords for languages
To fix this with exiftool you could delete all of the english keywords and write them back again with a "|" added to the first keyword.

It may be possible to design a user-defined tag which would allow you to automate this if a simple algorithm like putting the "|" in front of the Nth/2 + 1 keyword would work reliably.

- Phil
Direct Responses: 12341 | Write a response
Posted on 2010-02-08 10:46:35.950274-08 by infotalk in response to 12329
Re: Adding separator to keywords for languages
Hi Phil,

Thanks for the answer. I am new to this. I have no idea how to generate a PIPE to separate the keywords German/English.

Could you give me an example PLEASE.

Thanks in advance.
Direct Responses: 12343 | Write a response
Posted on 2010-02-08 11:28:23.687093-08 by exiftool in response to 12341
Re: Adding separator to keywords for languages
This config file defines a "MyKeywords" tag which does what I described:

%Image::ExifTool::UserDefined = ( 'Image::ExifTool::Composite' => { MyKeywords => { Require => 'Keywords', ValueConv => q{ my @v = ref $val ? @$val : $val; my $n = int(@v / 2); $v[$n] = "| $v[$n]"; return \@v; }, }, }, ); 1; # end

- Phil
Direct Responses: 12349 | 12368 | Write a response
Posted on 2010-02-09 10:01:43.681052-08 by infotalk in response to 12343
Re: Adding separator to keywords for languages
Hello Phil, It works. I have changed one row: my $n = int(@v / 2 - 2); %Image::ExifTool::UserDefined = ( 'Image::ExifTool::Composite' => { MyKeywordsPipe => { Require => 'IPTC:Keywords', ValueConv => q{ my @v = ref $val ? @$val : $val; my $n = int(@v / 2 - 2); $v[$n] = "| $v[$n]"; return \@v; }, }, MySubjectPipe => { Require => 'XMP:Subject', ValueConv => q{ my @v = ref $val ? @$val : $val; my $n = int(@v / 2 - 2); $v[$n] = "| $v[$n]"; return \@v; }, }, }, ); 1; # end IPTC and XMP show 1 pipe. One problem that I have, when I generate a text file (exiftool -k -G1 -H -a -u -s -w txt *.jpg) I see that there are new tags: [Composite] - MyKeywordsPipe: Ziegelstein, Zierde, | | adornment, architecture [Composite] - MySubjectPipe: Ziegelstein, Zierde, | | adornment, architecture Is there a way to delete these entries? Thank you very much!!!
Direct Responses: 12350 | Write a response
Posted on 2010-02-09 10:39:04.871247-08 by exiftool in response to 12349
Re: Adding separator to keywords for languages
You have 3 options:

1) Load the user-defined tags only when copying the keywords, (with -config FILE on the command line)

2) Disable the user-defined tags with -config "" when extracting the values afterwards.

3) Exclude specific tags when extracting with --mykeywordspipe --mysubjectpipe

- Phil
Direct Responses: 12358 | Write a response
Posted on 2010-02-10 08:28:36.769156-08 by infotalk in response to 12350
Re: Adding separator to keywords for languages
Hi Phil, I have expressed myself imprecisely. I want to delete the tags [Composite] - MyKeywordsPipe: [Composite] - MySubjectPipe: Thanks for the help!
Direct Responses: 12359 | Write a response
Posted on 2010-02-10 08:42:52.548926-08 by exiftool in response to 12358
Re: Adding separator to keywords for languages
I think we still have a misunderstanding. Are you trying to delete the composite tag value from the image, or just prevent it from being extracted? I described techiques for preventing it from being extracted. The value for the composite tag doesn't exist per se in the image because composite tags are derived from the values of other tags, so it can't be deleted as such. The only way to effectively remove a composite tag from an image is to deleted the tags from which it is derived.

- Phil
Direct Responses: 12362 | Write a response
Posted on 2010-02-10 12:47:03.976328-08 by infotalk in response to 12359
Re: Adding separator to keywords for languages
"composite tags are derived from the values of other tags, so it can't be deleted as such" OK Phil, thank you very much for helping me.
Direct Responses: Write a response
Posted on 2010-02-12 01:12:03.706936-08 by infotalk in response to 12343
Re: Adding separator to keywords for languages
Hi Phil, %Image::ExifTool::UserDefined = ( 'Image::ExifTool::Composite' => { MyKeywords => { Require => 'Keywords', ValueConv => q{ my @v = ref $val ? @$val : $val; my $n = int(@v / 2); $v[$n] = "| $v[$n]"; return \@v; }, }, }, ); 1; # end In above case there is 1 German keyword translated by 1 English keyword. But I have several keywords with synonyms. So it is possible that 1 German/English keyword is translated by 2 or more German/English keywords. Is there a way to set the PIPE like this: drehen, wirbeln | twirl Einkauf | purchase, shopping Thank you very much for giving me an example.
Direct Responses: 12369 | Write a response
Posted on 2010-02-12 04:44:47.173061-08 by exiftool in response to 12368
Re: Adding separator to keywords for languages
If you can come up with an algorithm then I can code it for you. Short of looking up each keyword in German and English dictionaries, how can the computer tell where to put the "|" symbol?

- Phil
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.