blib/lib/Lingua/BioYaTeA.pm

filter: Statementstmt 77.7% 28 / 36 Branchbran 66.6% 4 / 6 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 6 / 6 Podpod 100% 2 / 2 totaltotal 74.5% 41 / 55 SCAR 17.0
CC
5
Cov
73%
load_config
4.2
new
2.7
BEGIN
1.0
CRAP 5.5
« Build ↑ Summary _build/lib/Module/Build/Custom.pm »
1 package Lingua::BioYaTeA;
2  
3 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 5 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 =encoding utf8
8  
9 =head1 NAME
10  
11 Lingua::BioYaTeA - Perl extension of Lingua::YaTeA for extracting terms from a biomedical corpus.
12  
13 =head1 SYNOPSIS
14  
15 use Lingua::BioYaTeA;
16  
17 my %config = Lingua::YaTeA::load_config($rcfile);
18  
19 $yatea = Lingua::YaTeA->new($config{"OPTIONS"}, \%config);
20  
21 $corpus = Lingua::YaTeA::Corpus->new($corpus_path,$yatea->getOptionSet,$yatea->getMessageSet);
22  
23 $yatea->termExtraction($corpus);
24  
25  
26 =head1 DESCRIPTION
27  
28 This module is the main module of the software BioYaTeA which is an
29 adaptation of YaTeA (C<Lingua::YaTeA>) for biomedical text.
30  
31 The module inherits from all the class and attributes of
32 C<Lingua::YaTeA>. The input and output files but also the
33 configuration files follow the same format as YaTeA.
34 The tuning concerns the configuration files (in the directory
35 C<share/BioYaTeA>.
36  
37 Default configuration is assumed to be C</etc/bioyatea/bioyatea.rc>.
38  
39 For the use of BioYaTeA, see the documentation with the script
40 C<bioyatea>.
41  
42 =head1 METHODS
43  
44 =head2 new()
45  
46 new($command_line_options_h,$system_config_h);
47  
48 The methods creates a new term extractor and sets options from the
49 command line (C<$commend_line_options_h>) and options defined in the
50 hashtable (C<$system_config_h>) given by address. The methods returns
51 the created object.
52  
53 =head2 load_config()
54  
55 load_config($rcfile);
56  
57 The method loads the configuration of the NLP Platform by reading the
58 configuration file given in argument. It returns the hashtable
59 containing the configuration.
60  
61  
62 =head1 SEE ALSO
63  
64 Documentation of Lingua::YaTeA
65  
66 =head1 AUTHORS
67  
68 Wiktoria Golik <wiktoria.golik@jouy.inra.fr>, Zorana Ratkovic <Zorana.Ratkovic@jouy.inra.fr>, Robert Bossy <Robert.Bossy@jouy.inra.fr>, Claire Nédellec <claire.nedellec@jouy.inra.fr>, Thierry Hamon <thierry.hamon@univ-paris13.fr>
69  
70 =head1 LICENSE
71  
72 Copyright (C) 2012 Wiktoria Golik, Zorana Ratkovic, Robert Bossy, Claire Nédellec and Thierry Hamon
73  
74 This library is free software; you can redistribute it and/or modify
75 it under the same terms as Perl itself, either Perl version 5.8.6 or,
76 at your option, any later version of Perl 5 you may have available.
77  
78  
79 =cut
80  
81 5 ▶use Lingua::YaTeA;
Subroutine BEGIN: called CC=1 SCAR=0.0
82  
83 5 our @ISA = qw(Lingua::YaTeA);
84  
85 5 our $VERSION='0.11';
86  
87 sub new {
88 4 ▶ my ($class,$command_line_options_h,$system_config_h) = @_;
Subroutine new: called CC=2 SCAR=10.1
Pod documented
89  
90 4 ▶ if ($Lingua::YaTeA::VERSION < 0.6) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Lingua::YaTeA::VERSION < "0.6") 0 4 4
91 0 warn "***************************************************************************\n";
92 0 warn "Something wrong: attempting to use a version Lingua::YaTeA greater than 0.6\n";
93 0 warn "while found version is " . $Lingua::YaTeA::VERSION . "\n";
94 0 warn "Please install the right version\n\n";
95 0 warn "Exiting...\n";
96 0 warn "***************************************************************************\n";
97 0 exit -1;
98 }
99 4 my $this = $class->SUPER::new($command_line_options_h,$system_config_h);
100 4 bless ($this,$class);
101  
102 4 return $this;
103 }
104  
105 sub load_config {
106 # my ($class, $rcfile) = @_;
107  
108 4 ▶ my $rcfile;
Subroutine load_config: called CC=4 SCAR=14.5
Pod documented
109 4 my $class = shift;
110  
111 4 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 3 1 4
112 3 $rcfile = shift;
113 } else {
114 1 $rcfile = $class;
115 }
116
117
118 4 ▶ if ((! defined $rcfile) || ($rcfile eq "")) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $rcfile or $rcfile eq "") 0 4 4
Condition33%1/3
not defined $rcfile or $rcfile eq ""
l!l&&r!l&&!r
004
MC/DC0%0/2
not defined $rcfile or $rcfile eq ""
not defined $rcfile $rcfile eq ""
Truth table33%1/3
not(A) or B
A= not defined $rcfileB= $rcfile eq ""
ABresult
1X1
011
000
119 0 $rcfile = "/etc/bioyatea/bioyatea.rc";
120 }
121  
122 4 print STDERR "$rcfile : $class\n";
123  
124 4 return(Lingua::YaTeA::load_config($rcfile));
125 }
126  
127 5 1;
« Build ↑ Summary _build/lib/Module/Build/Custom.pm »