Skip to content

Commit

Permalink
Verify birth and death years against dbpedia
Browse files Browse the repository at this point in the history
  • Loading branch information
nigelhorne committed Dec 17, 2024
1 parent 3244376 commit ae888f0
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions gedcom
Original file line number Diff line number Diff line change
Expand Up @@ -550,12 +550,12 @@ my $dfn;
if(defined($language) && ($language eq 'French')) {
# $dfn = DateTime::Format::Natural->new(format => 'dd/mm/yy', lang => 'fr'); # not supported
$dfn = DateTime::Format::Natural->new(format => 'dd/mm/yy');
Date_Init("DateFormat=FR"); # Date::Manip
Date_Init('DateFormat=FR'); # Date::Manip
$lcm->set_lang('fr');
} elsif((defined($ENV{'LC_TIME'}) && ($ENV{'LC_TIME'} =~ /^en_US/)) ||
((defined($ENV{'LC_ALL'}) && ($ENV{'LC_ALL'} =~ /^en_US/)))) {
$dfn = DateTime::Format::Natural->new();
Date_Init("DateFormat=US"); # Date::Manip
Date_Init('DateFormat=US'); # Date::Manip
if(defined($lcm)) {
$lcm->set_lang('en');
}
Expand All @@ -564,7 +564,7 @@ if(defined($language) && ($language eq 'French')) {
if(defined($language)) {
Date_Init("Language=$language"); # Date::Manip
} else {
Date_Init("DateFormat=International");
Date_Init('DateFormat=International');
}
if($lcm) {
$lcm->set_lang(get_language_code() // 'en');
Expand Down Expand Up @@ -13691,6 +13691,7 @@ sub dbpedia
my $birth_dt = $params->{'birth_dt'};
my $yob = $params->{'yob'};
my $birth_country = $params->{'birth_country'};
my $dbpedia = Class::Simple->new();

if(defined($birth_dt)) {
if(!ref($birth_dt)) {
Expand Down Expand Up @@ -13877,14 +13878,15 @@ sub dbpedia
# Born different year from the dbpedia person was born
next RESULT;
}
$dbpedia->birth($b);
} elsif(($uri =~ /(\d{3,4})s_deaths/)) {
if($yob > ($1 + 20)) {
# Born after the end of the decade this person died
next RESULT;
}
} elsif(($uri =~ /(\d{3,4})s_births/)) {
if($yob < ($1 - 20)) {
# Born sometime before the start of the decard this person was born
# Born sometime before the start of the decade this person was born
next RESULT;
}
} elsif($uri =~ /(\d\d)th-century_deaths/) {
Expand All @@ -13899,13 +13901,20 @@ sub dbpedia
# Born after this person died
next RESULT;
}
$dbpedia->death($d);
}
}
warn ">>>>>>>>>> dbpedia allowing possibility $uri" if($opts{'w'});
}
}
$Data::Dumper::Maxdepth = 0;
print STDERR Data::Dumper->new([\$result])->Dump();
if(defined($yob) && (my $b = $dbpedia->birth()) && ($dbpedia->birth() != $yob)) {
complain({ person => $person, warning => "Year of birth may be inaccurate: ($yob != $b)" });
}
if(defined($yod) && (my $d = $dbpedia->death()) && ($dbpedia->death() != $yod)) {
complain({ person => $person, warning => "Year of death may be inaccurate: ($yod != $d)" });
}
if($opts{'c'}) {
$t =~ s/\.$//;
return "$t ($url).";
Expand Down Expand Up @@ -14023,6 +14032,7 @@ sub new

$pixelsperline = 16;

# Return the blessed object
return bless { y => 750, page => $pdf->page(), page_number => $page_number++ }, $class;
}

Expand Down

0 comments on commit ae888f0

Please sign in to comment.