Blame view

morfeusz/cli/outputUtils.hpp 1.25 KB
Michał Lenart authored
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
Michał Lenart authored
11
#include <cstdio>
Michał Lenart authored
12
#include "morfeusz2.h"
Michał Lenart authored
13
Michał Lenart authored
14
15
namespace morfeusz {
Michał Lenart authored
16
void printMorphResults(const Morfeusz& morfeusz, const std::vector<MorphInterpretation>& res, bool printNodeNumbers) {
Michał Lenart authored
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
Michał Lenart authored
23
                && (prevStart != mi.startNode || prevEnd != mi.endNode)) {
Michał Lenart authored
24
25
26
            printf("]\n[");
        }
        else if (prevStart != -1) {
Michał Lenart authored
27
            printf("\n ");
Michał Lenart authored
28
29
30
        }
        //            printf("%s", mi.toString(true).c_str());
        if (printNodeNumbers) {
Michał Lenart authored
31
            printf("%d,%d,", mi.startNode, mi.endNode);
Michał Lenart authored
32
        }
Michał Lenart authored
33
34
35
        printf("%s,%s,%s,%s,%s",
                mi.orth.c_str(),
                mi.lemma.c_str(),
Michał Lenart authored
36
37
38
                mi.getTag(morfeusz).c_str(),
                mi.nameId == 0 ? "_" : mi.getName(morfeusz).c_str(),
                mi.labelsId == 0 ? "_" : mi.getLabelsAsString(morfeusz).c_str());
Michał Lenart authored
39
40
        prevStart = mi.startNode;
        prevEnd = mi.endNode;
Michał Lenart authored
41
42
43
44
    }
    printf("]\n");
}
Michał Lenart authored
45
46
}
Michał Lenart authored
47
48
#endif	/* OUTPUTUTILS_HPP */