-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdula.cpp
46 lines (39 loc) · 1.06 KB
/
dula.cpp
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
#include <string>
#include <iostream>
#include "levenshtein.h"
#include <string.h>
#include <stdlib.h>
int main (int argc, char *argv[]) {
int k = 1;
bool fsm=false, fst=false, dot=false;
for (int idx=1 ; idx<argc ; idx++) {
if (!strcmp(argv[idx], "-k")) {
idx += 1;
k = atoi(argv[idx]);
} else if (!strcmp(argv[idx], "-fsm")) {
fsm = true;
} else if (!strcmp(argv[idx], "-fst")) {
fst = true;
} else if (!strcmp(argv[idx], "-dot")) {
dot = true;
} else {
cerr << "No option named " << argv[idx] << endl;
exit(1);
}
}
cout << "Generation of the automaton dula " << std::to_string(k) << endl;
Automaton * aut = dula(k);
cout << aut->states.size() << " states generated" << endl;
if (!(dot || fsm || fst)) {
saveAutomaton (aut, "dula" + std::to_string(k) + ".fsm");
} else {
if (fsm)
saveAutomaton (aut, "dula" + std::to_string(k) + ".fsm");
if (dot)
graphVizOutput (aut, "dula" + std::to_string(k) + ".dot");
if (fst)
saveAutomatonAsFst (aut, "dula" + std::to_string(k) + ".fst.txt", 2*k+1);
}
delete aut;
return 0;
}