consoleUtils.hpp
1.06 KB
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
/*
* File: consoleUtils.hpp
* Author: lennyn
*
* Created on April 4, 2014, 7:36 PM
*/
#ifndef CONSOLEUTILS_HPP
#define CONSOLEUTILS_HPP
#include <vector>
#include <string>
#include "MorphInterpretation.hpp"
template <class OutputStream>
void appendMorfeuszResults(const std::vector<MorphInterpretation>& res, OutputStream& out) {
int prevStart = -1;
int prevEnd = -1;
out << "[";
for (unsigned int i = 0; i < res.size(); i++) {
const MorphInterpretation& mi = res[i];
if (prevStart != -1
&& (prevStart != mi.getStartNode() || prevEnd != mi.getEndNode())) {
out << "]\n[";
}
else if (prevStart != -1) {
out << "; ";
}
out << mi.getStartNode() << ","
<< mi.getEndNode() << ","
<< mi.getOrth() << ","
<< mi.getLemma() << ","
<< mi.getTag() << ","
<< mi.getName();
prevStart = mi.getStartNode();
prevEnd = mi.getEndNode();
}
out << "]\n";
}
#endif /* CONSOLEUTILS_HPP */