|
1
2
3
4
5
6
7
8
9
10
|
/*
* File: outputUtils.hpp
* Author: mlenart
*
* Created on 15 maj 2014, 17:45
*/
#ifndef OUTPUTUTILS_HPP
#define OUTPUTUTILS_HPP
|
|
11
|
#include <cstdio>
|
|
12
|
#include "morfeusz2.h"
|
|
13
|
|
|
14
15
|
namespace morfeusz {
|
|
16
|
void printMorphResults(const Morfeusz& morfeusz, const std::vector<MorphInterpretation>& res, bool printNodeNumbers) {
|
|
17
18
19
20
21
22
|
printf("[");
int prevStart = -1;
int prevEnd = -1;
for (unsigned int i = 0; i < res.size(); i++) {
const MorphInterpretation& mi = res[i];
if (prevStart != -1
|
|
23
|
&& (prevStart != mi.startNode || prevEnd != mi.endNode)) {
|
|
24
25
26
|
printf("]\n[");
}
else if (prevStart != -1) {
|
|
27
|
printf("\n ");
|
|
28
29
30
|
}
// printf("%s", mi.toString(true).c_str());
if (printNodeNumbers) {
|
|
31
|
printf("%d,%d,", mi.startNode, mi.endNode);
|
|
32
|
}
|
|
33
34
35
|
printf("%s,%s,%s,%s,%s",
mi.orth.c_str(),
mi.lemma.c_str(),
|
|
36
37
38
|
mi.getTag(morfeusz).c_str(),
mi.nameId == 0 ? "_" : mi.getName(morfeusz).c_str(),
mi.labelsId == 0 ? "_" : mi.getLabelsAsString(morfeusz).c_str());
|
|
39
40
|
prevStart = mi.startNode;
prevEnd = mi.endNode;
|
|
41
42
43
44
|
}
printf("]\n");
}
|
|
45
46
|
}
|
|
47
48
|
#endif /* OUTPUTUTILS_HPP */
|