forked from usnistgov/trec_eval
-
Notifications
You must be signed in to change notification settings - Fork 1
/
meas_print_single.c
93 lines (83 loc) · 2.46 KB
/
meas_print_single.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
/*
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 single query 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 single measure generic procedures -------------- */
/* Measure does not require printing */
int
te_print_single_meas_empty (const EPI *epi, const TREC_MEAS *tm,
const TREC_EVAL *eval)
{
return (1);
}
/* Measure is a single double measure with no parameters, */
int
te_print_single_meas_s_double(const EPI * epi, const TREC_MEAS * tm,
const TREC_EVAL * eval)
{
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%6.4f\n",
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_single_meas_s_long (const EPI *epi, const TREC_MEAS *tm,
const TREC_EVAL *eval)
{
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_single_meas_a_cut(const EPI * epi, const TREC_MEAS * tm,
const TREC_EVAL * eval)
{
long i;
for (i = 0; i < tm->meas_params->num_params; i++) {
if (epi->zscore_flag)
printf ("Z%-22s\t%s\t%6.4f\n",
eval->values[tm->eval_index+i].name,
eval->qid,
eval->values[tm->eval_index+i].value);
else
printf ("%-22s\t%s\t%6.4f\n",
eval->values[tm->eval_index+i].name,
eval->qid,
eval->values[tm->eval_index+i].value);
}
return (1);
}