summaryrefslogtreecommitdiff
path: root/src/parser_test.cc
blob: da1fbd892c33edd4988aad07fccb9b574165fbc3 (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
#include <cassert>
#include <iostream>
#include <fstream>
#include <vector>
#include <gtest/gtest.h>
#include "hg.h"
#include "trule.h"
#include "bottom_up_parser.h"
#include "tdict.h"

using namespace std;

class ChartTest : public testing::Test {
 protected:
  virtual void SetUp() { }
  virtual void TearDown() { }
};
       
TEST_F(ChartTest,LanguageModel) {
  LatticeArc a(TD::Convert("ein"), 0.0, 1);
  LatticeArc b(TD::Convert("haus"), 0.0, 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);
}

int main(int argc, char **argv) {
  testing::InitGoogleTest(&argc, argv);
  return RUN_ALL_TESTS();
}