-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathmeas_print_final.c
102 lines (89 loc) · 3.15 KB
/
meas_print_final.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/*
Copyright (c) 2008 - Chris Buckley.
Permission is granted for use and modification of this file for
research, non-commercial purposes.
*/
#include "common.h"
#include "sysfunc.h"
#include "trec_eval.h"
#include "functions.h"
/* Procedures for printing of summary and cleaning up several default formats
of measure values.
Used in init_meas procedure description of TREC_MEAS in trec_eval.h:
typedef struct trec_meas {
...
* Store parameters for measure in meas_params. Reserve space in
TREC_EVAL.values for results of measure. Store individual measure
names (possibly altered by parameters) in TREC_EVAL.values.
Set tm->eval_index to start of reserved space *
...
} TREC_MEAS;
Measures are defined in measures.c.
*/
/* ---------------- Print final measure generic procedures -------------- */
/* Measure does not require printing or storage */
int te_print_final_meas_empty(const EPI * epi, TREC_MEAS * tm, TREC_EVAL * eval)
{
return (1);
}
/* Measure is a single double measure with no parameters */
int
te_print_final_meas_s_double(const EPI * epi, TREC_MEAS * tm, TREC_EVAL * eval)
{
if (epi->summary_flag)
printf("%s%-22s\t%s\t%6.4f\n",
epi->zscore_flag ? "Z" : "",
eval->values[tm->eval_index].name,
eval->qid, eval->values[tm->eval_index].value);
return (1);
}
/* Measure is a single long measure with no parameters. */
int
te_print_final_meas_s_long(const EPI * epi, TREC_MEAS * tm, TREC_EVAL * eval)
{
if (epi->summary_flag) {
if (epi->zscore_flag)
printf("Z%-22s\t%s\t%6.4f\n",
eval->values[tm->eval_index].name,
eval->qid, eval->values[tm->eval_index].value);
else
printf("%-22s\t%s\t%ld\n",
eval->values[tm->eval_index].name,
eval->qid, (long) eval->values[tm->eval_index].value);
}
return (1);
}
/* Measure is a double array with cutoffs */
int te_print_final_meas_a_cut(const EPI * epi, TREC_MEAS * tm, TREC_EVAL * eval)
{
long i;
for (i = 0; i < tm->meas_params->num_params; i++) {
if (epi->summary_flag)
printf("%s%-22s\t%s\t%6.4f\n",
epi->zscore_flag ? "Z" : "",
eval->values[tm->eval_index + i].name,
eval->qid, eval->values[tm->eval_index + i].value);
Free(eval->values[tm->eval_index + i].name);
}
if (tm->meas_params->printable_params) {
Free(tm->meas_params->param_values);
Free(tm->meas_params->printable_params);
}
return (1);
}
/* Measure is a single double with double params */
int
te_print_final_meas_s_double_p(const EPI * epi, TREC_MEAS * tm, TREC_EVAL * eval)
{
if (epi->summary_flag)
printf("%s%-22s\t%s\t%6.4f\n",
epi->zscore_flag ? "Z" : "",
eval->values[tm->eval_index].name,
eval->qid, eval->values[tm->eval_index].value);
if (tm->meas_params->printable_params) {
Free(eval->values[tm->eval_index].name);
Free(tm->meas_params->printable_params);
Free(tm->meas_params->param_values);
}
return (1);
}