morfeusz_analyzer_old.cpp
1.03 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
43
/*
* Copied from old version of morfeusz.
*/
#include <stdio.h>
#include "morfeusz2_c.h"
#define BUFLEN 10000
int main() {
InterpMorf *mo;
char buf[BUFLEN];
// morfeusz_set_option(MORFOPT_ENCODING, MORFEUSZ_ISO8859_2);
#ifdef __WIN32
morfeusz_set_option(MORFOPT_ENCODING, MORFEUSZ_CP852);
#else
morfeusz_set_option(MORFOPT_ENCODING, MORFEUSZ_UTF_8);
#endif
fprintf(stderr, "%s\n\n", morfeusz_about());
while (fgets(buf, BUFLEN, stdin)) {
int i = 0, prevp = -1;
mo = morfeusz_analyse(buf);
if (mo[0].p == -1) continue;
printf("[");
while (mo[i].p != -1) {
if (prevp != -1) {
if (prevp != mo[i].p) printf("]\n[");
else printf("; ");
}
printf("%s,%s,%s",
// mo[i].p, mo[i].k,
mo[i].forma,
mo[i].haslo == NULL ? "?" : mo[i].haslo,
mo[i].interp == NULL ? "?" : mo[i].interp);
prevp = mo[i].p;
i++;
}
printf("]\n");
}
return 0;
}