blob: 06c9fa06bf43742d9716718838714b2c4ed91d93 (
plain)
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
47
48
49
50
51
52
53
54
55
|
#include "parse.hh"
namespace Parse {
} //
vector<G::T> tokenize(string s)
{
istringstream ss(s);
vector<G::T> res;
while (ss.good()) {
string t;
ss >> t;
G::T i(t);
cout << i.word << endl;
res.push_back(i);
}
return res;
}
bool operator==(vector<G::Item> const& a, vector<G::Item> const& b)
{
if (a.size() != b.size()) return false;
for (auto it: a)
}
int main(int argc, char** argv)
{
string in("karten haie");
vector<G::T> tok = tokenize(in);
for (auto it: tok)
cout << it.word << ",";
cout << endl;
size_t n = tok.size();
G::Grammar g(argv[1]);
vector<Span> spans;
Parse::visit(spans, 1, 0, 6);
for (auto it: spans) {
cout << "(" << it.first << "," << it.second << ")" << endl;
}
Parse::Chart active(n);
Parse::Chart passive(n);
//init(tok, n, active, passive, g);
cout << *(g.flat.at(0)) << endl;
}
|