File Coverage

blib/lib/String/Normal/Config/BusinessCompress.pm
Criterion Covered Total %
statement 18 18 100.0
branch 3 4 75.0
condition n/a
subroutine 4 4 100.0
pod n/a
total 25 26 96.1


line stmt bran cond sub pod time code
1             package String::Normal::Config::BusinessCompress;
2 9     9   29 use strict;
  9         8  
  9         186  
3 9     9   25 use warnings;
  9         10  
  9         161  
4              
5 9     9   32 use String::Normal::Config;
  9         10  
  9         1177  
6              
7             sub _data {
8 3     3   7 my %params = @_;
9              
10 3         4 my $fh;
11 3 100       9 if ($params{business_compress}) {
12 1 50       23 open $fh, $params{business_compress} or die "Can't read '$params{business_compress}' $!\n";
13             } else {
14 2         6 $fh = *DATA;
15             }
16              
17 3         4 my %compress;
18 3         9 for (String::Normal::Config::_expand_ranges( String::Normal::Config::_slurp( $fh ) )) {
19 1101         1727 String::Normal::Config::_attach( \%compress, split '-', $_ );
20             }
21              
22 3         126 return \%compress;
23             }
24              
25             1;
26              
27             =head1 NAME
28              
29             String::Normal::Config::BusinessCompress;
30              
31             =head1 DESCRIPTION
32              
33             This package defines compressions to be performed on Business types.
34              
35             =head1 STRUCTURE
36              
37             One entry per line, each entry contains the multi word term joined by dashes (C<->):
38              
39             foo-bar-baz
40              
41             Would compress C C and C so long as they are found in that order
42             in the token list. Consider the many different varations of the word "barbecue" and
43             you might see where this kind of transformation is valuable in detecting potential
44             duplicates.
45              
46             You can provide your own data by creating a text file containing your
47             values and provide the path to that file via the constructor:
48              
49             my $normalizer = String::Normal->new( business_compress => '/path/to/values.txt' );
50              
51             =head1 AUTHOR
52              
53             Jeff Anderson, C<< >>
54              
55             =head1 LICENSE AND COPYRIGHT
56              
57             Copyright 2017 Jeff Anderson.
58              
59             This program is free software; you can redistribute it and/or modify it
60             under the terms of the the Artistic License (2.0). You may obtain a
61             copy of the full license at:
62              
63             L
64              
65             Any use, modification, and distribution of the Standard or Modified
66             Versions is governed by this Artistic License. By using, modifying or
67             distributing the Package, you accept this license. Do not use, modify,
68             or distribute the Package, if you do not accept this license.
69              
70             If your Modified Version has been derived from a Modified Version made
71             by someone other than you, you are nevertheless required to ensure that
72             your Modified Version complies with the requirements of this license.
73              
74             This license does not grant you the right to use any trademark, service
75             mark, tradename, or logo of the Copyright Holder.
76              
77             This license includes the non-exclusive, worldwide, free-of-charge
78             patent license to make, have made, use, offer to sell, sell, import and
79             otherwise transfer the Package with respect to any patent claims
80             licensable by the Copyright Holder that are necessarily infringed by the
81             Package. If you institute patent litigation (including a cross-claim or
82             counterclaim) against any party alleging that the Package constitutes
83             direct or contributory patent infringement, then this Artistic License
84             to you shall terminate on the date that such litigation is filed.
85              
86             Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER
87             AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
88             THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
89             PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY
90             YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR
91             CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR
92             CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE,
93             EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
94              
95             =cut
96              
97             __DATA__