Skip to content

Commit

Permalink
Remove dup false positive and print more Employment records
Browse files Browse the repository at this point in the history
  • Loading branch information
nigelhorne committed Aug 5, 2024
1 parent e0a8262 commit 90fb5e5
Showing 1 changed file with 53 additions and 28 deletions.
81 changes: 53 additions & 28 deletions ged2site
Original file line number Diff line number Diff line change
Expand Up @@ -787,14 +787,14 @@ my %censusmaps = (

# sub die {
# my @arg = shift;
#
#
# print STDERR "@arg\n" if($arg[0]);
#
#
# my $i = 0;
# while((my @call_details = (caller($i++)))) {
# print STDERR $call_details[1], ':', $call_details[2], ' in function ', $call_details[3], "\n";
# }
#
#
# realdie @arg;
# }

Expand Down Expand Up @@ -2014,6 +2014,12 @@ sub print_person
if(my $pdob = dateofbirth($possible)) {
my $year = get_year_from_date($pdob);
next if(abs($yob - $year) > 2);
if((my $f1 = $person->father()) && (my $f2 = $possible->father())) {
if((my $fdob = dateofbirth($person)) && (my $pfdob = dateofbirth($f2))) {
# Fathers born more than 10 years apart - not a dup
next if(abs(get_year_from_date($fdob) - get_year_from_date($pfdob)) > 10);
}
}
complain({ person => $person, warning => 'potential duplicate person found' });
# DEBUG: warn while looking for false positives
warn 'Potential match: ', $person->as_string($string_args), "/$yob/$year/", $possible->as_string($string_args);
Expand Down Expand Up @@ -3430,6 +3436,7 @@ sub print_person
$phrase->append(" $y") if($y);
}
$bio .= cite(@birthcitations);
$phrase->append(cite(@birthcitations));
if($dateofbaptism || $placeofbaptism) {
if($phrase->length()) {
push @phrases, $phrase;
Expand Down Expand Up @@ -4503,7 +4510,7 @@ sub print_person
(scalar(@spouses) == 2) &&
($spouse_number == 2) &&
(my $death_of_first_spouse = dateofdeath($spouses[0]))) {
# Determine if the second marriage was after a divorce or death
# Determine if the second marriage was after a divorce or death
if(datecmp($dateofmarriage, $death_of_first_spouse) > 0) {
if($printed_bracket) {
$bio .= ', ';
Expand Down Expand Up @@ -4568,13 +4575,15 @@ sub print_person
}
if(scalar(@names)) {
$phrase->append(' (' . i18n('to ') . conjunction(@names) . ')');
if($marriagecitation) {
$phrase->append(cite(($marriagecitation)));
}
push @phrases, $phrase;
$phrase = Data::Text->new();
}
# substr($names, rindex($names, ', '), 2, ' and ');
if($marriagecitation) {
$bio = cite(($marriagecitation));
$phrase->append(cite(($marriagecitation)));
}

# Determine if all the children are from one marriage, since that's
Expand Down Expand Up @@ -4631,6 +4640,7 @@ sub print_person
if($phrase->trim()->length() > 0) {
push @phrases, $phrase;
}

$bio_dt->append(conjunction(map { $_->as_string() } @phrases))->append('. ');
$phrase = Data::Text->new("$pronoun ");
@phrases = ();
Expand Down Expand Up @@ -6644,6 +6654,34 @@ sub print_person
$bio .= ' was granted a coat of arms';
$phrase->append(' was granted a coat of arms');
$end_of_sentence = 0;
} elsif($type eq 'Employment') {
if($end_of_sentence) {
$bio .= ' ' unless($bio =~ /\s$/);
} else {
$bio .= '. ';
}
if($phrase->length()) {
push @phrases, $phrase;
$bio_dt->append(conjunction(map { $_->as_string() } @phrases))->append('. ');
$phrase = Data::Text->new();
@phrases = ();
} else {
$phrase->set(' ');
$bio_dt->append(' ');
}
if(my $date = year(record => $event)) {
$date = ucfirst($date);
$bio .= "$date " . lcfirst($pronoun) . ' was working';
$phrase->append("$date " . lcfirst($pronoun) . ' was working');
} else {
$bio .= "$pronoun worked";
$phrase->append("$pronoun worked");
}
if(my $place = place(person => $person, record => $event)) {
$bio .= $place;
$phrase->append($place);
}
$end_of_sentence = 0;
# } elsif(($type !~ /^Census U[KS] \d{4}$/) &&
} elsif(($type !~ /Census/) &&
($type ne 'Race') &&
Expand All @@ -6652,7 +6690,7 @@ sub print_person
($type ne 'Register UK 1939')) {

complain({ person => $person, warning => "Unhandled event type: $type" });
die 'TODO: ', $person->as_string({ nee => 1, include_years => 1, middle_names => 1}), " event type $type";
die 'TODO: ', $person->as_string({ nee => 1, include_years => 1, middle_names => 1 }), " event type $type";
if(my $notes = notes(record => $event, note_locations => \@note_locations)) {
$notes = ucfirst($notes);
$bio .= " ($notes)";
Expand Down Expand Up @@ -12598,7 +12636,7 @@ sub cite

return '' unless($opts{'c'});

my %params;
my $params;

if(ref($_[0]) eq 'HASH') {
%params = %{$_[0]};
Expand Down Expand Up @@ -14525,17 +14563,10 @@ sub person_in_residence_record
# TODO: a lot of this should be table driven
sub wide_to_html
{
my %params;
my $params = get_params('string', @_);

if(ref($_[0]) eq 'HASH') {
%params = %{$_[0]};
} elsif(scalar(@_) % 2 == 0) {
%params = @_;
} elsif(scalar(@_) == 1) {
$params{'string'} = shift;
}
my $string = $params->{'string'};

my $string = $params{'string'};
if(!defined($string)) {
my $i = 0;
while((my @call_details = caller($i++))) {
Expand All @@ -14559,7 +14590,7 @@ sub wide_to_html
$string =~ s/Š/Š/g; # I don't think HTML::Entities does this
$string =~ s/&/&/g;

unless($params{'keep_hrefs'}) {
unless($params->{'keep_hrefs'}) {
$string =~ s/</&lt;/g;
$string =~ s/>/&gt;/g;
$string =~ s/"/&quot;/g;
Expand All @@ -14570,7 +14601,7 @@ sub wide_to_html
# $string =~ s/&db=/&amp;db=/g;
# $string =~ s/&id=/&amp;id=/g;

unless($params{'keep_apos'}) {
unless($params->{'keep_apos'}) {
$string =~ s/'/&apos;/g;
$string =~ s/‘/&apos;/g;
$string =~ s/’/&apos;/g;
Expand Down Expand Up @@ -14792,17 +14823,10 @@ sub wide_to_html
# https://www.compart.com/en/unicode/U+00EB
sub wide_to_xml
{
my %params;
my $params = get_params('string', @_);

if(ref($_[0]) eq 'HASH') {
%params = %{$_[0]};
} elsif(scalar(@_) % 2 == 0) {
%params = @_;
} elsif(scalar(@_) == 1) {
$params{'string'} = shift;
}
my $string = $params->{'string'};

my $string = $params{'string'};
if(!defined($string)) {
my $i = 0;
while((my @call_details = caller($i++))) {
Expand All @@ -14829,7 +14853,7 @@ sub wide_to_xml
$string =~ s/&Scaron;/Š/g; # I don't think HTML::Entities does this
$string =~ s/&/&amp;/g;

unless($params{'keep_hrefs'}) {
unless($params->{'keep_hrefs'}) {
$string =~ s/</&lt;/g;
$string =~ s/>/&gt;/g;
$string =~ s/"/&quot;/g;
Expand Down Expand Up @@ -15457,6 +15481,7 @@ sister::sister
sister-in-law::sister-in-law
sisters::sisters
son::son
sons::sons
the same day as::the same day as
they::they
times::times
Expand Down

0 comments on commit 90fb5e5

Please sign in to comment.