CRF.xs

filter: Statementstmt 0.0% 0 / 11 Branchbran 0.0% 0 / 26 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 0.0% 0 / 37 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
↑ Summary common.h »
1 #include "common.h"
2 #include "encoder.h"
3  
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7 #include "EXTERN.h"
8 #include "perl.h"
9 #include "XSUB.h"
10 #ifdef __cplusplus
11 }
12 #endif
13  
14 using namespace CRFPP;
15  
16 MODULE = Algorithm::CRF PACKAGE = Algorithm::CRF
17  
18 PROTOTYPES: ENABLE
19  
20 bool
21 crfpp_learn( templfile, trainfile, modelfile, textmodelfile, maxitr, freq, eta, C, thread_num , shrinking_size, algorithm, convert)
22 const char *templfile
23 const char *trainfile
24 const char *modelfile
25 bool textmodelfile
26 size_t maxitr
27 size_t freq
28 double eta
29 double C
30 unsigned short thread_num
31 unsigned short shrinking_size
32 int algorithm
33 bool convert
34 CODE:
35 0 ▶CRFPP::Encoder encoder;
Branch: 1 branch
BranchTrueFalseTotal
CRFPP::Encoder encoder; 0 0 0
36 0 ▶ if (thread_num > 1024)
Branch: 1 branch
BranchTrueFalseTotal
if (thread_num > 1024) 0 0 0
37 0 ▶ fprintf (stderr,"#thread is too big\n",encoder.what());
Branch: 2 branches
BranchTrueFalseTotal
fprintf (stderr,"#thread is too big\n",encoder.what()); 0 0 0
fprintf (stderr,"#thread is too big\n",encoder.what()); 0 0 0
38 0 ▶ if (convert) {
Branch: 1 branch
BranchTrueFalseTotal
if (convert) { 0 0 0
39 0 ▶ if (! encoder.convert(templfile, trainfile)) {
Branch: 2 branches
BranchTrueFalseTotal
if (! encoder.convert(templfile, trainfile)) { 0 0 0
if (! encoder.convert(templfile, trainfile)) { 0 0 0
40 //cerr << encoder.what() << endl;
41 0 ▶ fprintf (stderr,"%s\n",encoder.what());
Branch: 2 branches
BranchTrueFalseTotal
fprintf (stderr,"%s\n",encoder.what()); 0 0 0
fprintf (stderr,"%s\n",encoder.what()); 0 0 0
42 0 RETVAL = -1;
43 }
44 } else {
45 0 ▶ if (! encoder.learn ( templfile,
Branch: 2 branches
BranchTrueFalseTotal
if (! encoder.learn ( templfile, 0 0 0
if (! encoder.learn ( templfile, 0 0 0
46 trainfile,
47 modelfile,
48 textmodelfile,
49 maxitr,
50 freq,
51 eta,
52 C,
53 thread_num,
54 shrinking_size,
55 algorithm )) {
56 // cerr << encoder.what() << endl;
57 0 ▶ fprintf (stderr,"%s\n",encoder.what());
Branch: 2 branches
BranchTrueFalseTotal
fprintf (stderr,"%s\n",encoder.what()); 0 0 0
fprintf (stderr,"%s\n",encoder.what()); 0 0 0
58 0 RETVAL = -1;
59 } else
60 0 RETVAL = 0;
61 }
62 OUTPUT:
63 RETVAL
64  
↑ Summary common.h »