Fix country code conversion
Change-Id: I2f983daef41ca772392c394110fb2acd321b0f64
diff --git a/lib/KorAP/Def.pm b/lib/KorAP/Def.pm
index df24aa1..811b266 100644
--- a/lib/KorAP/Def.pm
+++ b/lib/KorAP/Def.pm
@@ -6,6 +6,16 @@
use strict;
use warnings;
+our %COUNTRY = (
+ I => 'IT',
+ A => 'AT',
+ BE => 'BE',
+ LI => 'LI',
+ D => 'DE',
+ L => 'LU',
+ CH => 'CH'
+);
+
sub new {
my $class = shift;
my $file = shift;
@@ -257,7 +267,7 @@
elsif ($key eq 'co') {
# Country, z.B. DE für Text in Deutschland erschienen
- ${$vc}->union_field(pubPlaceKey => $value);
+ ${$vc}->union_field(pubPlaceKey => $COUNTRY{$value} // $value);
}
elsif ($key eq 'tl') {
diff --git a/script/cosmasvc2koralquery b/script/cosmasvc2koralquery
index daed10b..ae74d94 100755
--- a/script/cosmasvc2koralquery
+++ b/script/cosmasvc2koralquery
@@ -16,6 +16,7 @@
# Add KorAP::Def.
# 2024-12-16
# Fix doc trimming
+# Fix country codes.
our $VERSION = 0.4;
our @ARGV;
diff --git a/t/list2vc-def.t b/t/list2vc-def.t
index 953f5c2..0a707d1 100644
--- a/t/list2vc-def.t
+++ b/t/list2vc-def.t
@@ -95,7 +95,7 @@
is($json->{'collection'}->{'@type'}, 'koral:doc', 'type');
is($json->{'collection'}->{'key'}, 'pubPlaceKey', 'type');
-is($json->{'collection'}->{'value'}, 'A', 'type');
+is($json->{'collection'}->{'value'}, 'AT', 'type');
is($json->{'collection'}->{'comment'}, 'name:"Korpora aus Österreich"', 'type');
my $corpw = catfile(dirname(__FILE__), 'data', 'corp-w-vas-n91-kor17');