diff options
author | Chris Dyer <redpony@gmail.com> | 2009-12-14 20:35:11 -0500 |
---|---|---|
committer | Chris Dyer <redpony@gmail.com> | 2009-12-14 20:35:11 -0500 |
commit | 851e389dffdd6996ea32d70defb8906de80b9edc (patch) | |
tree | 8c68ee77205badc056b8ab5b332e67e3e98017df /src/grammar_test.cc | |
parent | dc6930c00b4b276883280cff1ed6dcd9ddef03c7 (diff) |
few small fixes of alignment tools, add new orthographic similarity feature for word aligner, final naming of directories, libraries in cdec
Diffstat (limited to 'src/grammar_test.cc')
-rw-r--r-- | src/grammar_test.cc | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/src/grammar_test.cc b/src/grammar_test.cc deleted file mode 100644 index 62b8f958..00000000 --- a/src/grammar_test.cc +++ /dev/null @@ -1,59 +0,0 @@ -#include <cassert> -#include <iostream> -#include <fstream> -#include <vector> -#include <gtest/gtest.h> -#include "trule.h" -#include "tdict.h" -#include "grammar.h" -#include "bottom_up_parser.h" -#include "ff.h" -#include "weights.h" - -using namespace std; - -class GrammarTest : public testing::Test { - public: - GrammarTest() { - wts.InitFromFile("test_data/weights.gt"); - } - protected: - virtual void SetUp() { } - virtual void TearDown() { } - Weights wts; -}; - -TEST_F(GrammarTest,TestTextGrammar) { - vector<double> w; - vector<const FeatureFunction*> ms; - ModelSet models(w, ms); - - TextGrammar g; - TRulePtr r1(new TRule("[X] ||| a b c ||| A B C ||| 0.1 0.2 0.3", true)); - TRulePtr r2(new TRule("[X] ||| a b c ||| 1 2 3 ||| 0.2 0.3 0.4", true)); - TRulePtr r3(new TRule("[X] ||| a b c d ||| A B C D ||| 0.1 0.2 0.3", true)); - cerr << r1->AsString() << endl; - g.AddRule(r1); - g.AddRule(r2); - g.AddRule(r3); -} - -TEST_F(GrammarTest,TestTextGrammarFile) { - GrammarPtr g(new TextGrammar("./test_data/grammar.prune")); - vector<GrammarPtr> grammars(1, g); - - 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; - ExhaustiveBottomUpParser parser("PHRASE", grammars); - parser.Parse(lattice, &forest); - forest.PrintGraphviz(); -} - -int main(int argc, char **argv) { - testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} |