blob: 37c45cc8c55f2cf057ed2111342e415466a37447 (
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
|
#define BOOST_TEST_MODULE ParseTest
#include <boost/test/unit_test.hpp>
#include <boost/test/floating_point_comparison.hpp>
#include "lattice.h"
#include "hg.h"
#include "trule.h"
#include "bottom_up_parser.h"
#include "tdict.h"
using namespace std;
BOOST_AUTO_TEST_CASE(Parse) {
LatticeArc a(TD::Convert("ein"), SparseVector<double>(), 1);
LatticeArc b(TD::Convert("haus"), SparseVector<double>(), 1);
Lattice lattice(2);
lattice[0].push_back(a);
lattice[1].push_back(b);
Hypergraph forest;
GrammarPtr g(new TextGrammar);
vector<GrammarPtr> grammars(1, g);
ExhaustiveBottomUpParser parser("PHRASE", grammars);
parser.Parse(lattice, &forest);
}
|