my ($class, %args) = @_;
my $self = bless { data => { recs => undef, # X::T record objects
- rcnt => 0, # next record counter
+ rcnt => 0, # record counter
+ tcnt => 0, # tag counter
samp => {}, # data samples
tags => {}, # all found tags
},
return unless ($tag and $tag > 9);
# increment raw tag count
+ $self->{data}{tcnt}++;
$self->{data}{tags}{$tag}++;
if ($map and $map->has($tag)) {
# set a value, total-seen count and records-seen-in count
$samp->{$tag}{$code}{value} = $sub->text unless defined $samp->{$tag}{$code};
$samp->{$tag}{$code}{count}++;
- $samp->{$tag}{$code}{rcnt}++ unless ( defined $samp->{$tag}{$code}{last} and
- $samp->{$tag}{$code}{last} == $self->{data}{rcnt} );
- $samp->{$tag}{$code}{last} = $self->{data}{rcnt};
+ $samp->{$tag}{$code}{tcnt}++ unless ( defined $samp->{$tag}{$code}{last} and
+ $samp->{$tag}{$code}{last} == $self->{data}{tcnt} );
+ $samp->{$tag}{$code}{last} = $self->{data}{tcnt};
#FIXME tcnt not rcnt
}
{ tag_id => {
sub_code => { value => VALUE,
count => COUNT,
- rcnt => RCOUNT
+ tcnt => TAGCOUNT
},
...
},
* value - A sample of the subfield text
* count - Total number of times the subfield was seen
- * rcnt - The number of records the subfield was seen in
+ * tcnt - The number of tags the subfield was seen in
=head1 AUTHOR
is (defined $sample->{999}{x}, 1);
is ($sample->{999}{x}{value}, 'MYSTERY', 'Should be the first seen value');
is ($sample->{999}{x}{count}, 7, 'One real in each record, plus 3 synthetic in last rec');
-is ($sample->{999}{x}{rcnt}, 4, 'Occurs in all records');
-is ($sample->{999}{s}{rcnt}, 3, 'Was removed from one record');
+is ($sample->{999}{x}{tcnt}, 4, 'Occurs in all records');
+is ($sample->{999}{s}{tcnt}, 3, 'Was removed from one record');
my $tags = $mp->{data}{tags};
is ($tags->{961}, 4);