public void TestChunkingParserTraining() { var parseSamples = ParserTestUtil.CreateParseTestStream(); //var testSamples = ParserTestUtil.CreateParseTestStream(); var headRules = ParserTestUtil.CreateTestHeadRules(); var model = SharpNL.Parser.Chunking.Parser.Train("en", parseSamples, headRules, 100, 0); Assert.NotNull(model); var parser = ParserFactory.Create(model); Assert.NotNull(parser); ParserModel deserialized; using (var stream = new MemoryStream()) { model.Serialize(new UnclosableStream(stream)); stream.Seek(0, SeekOrigin.Begin); deserialized = new ParserModel(stream); } Assert.NotNull(deserialized); // TODO: compare both models }
public void TestTreeInsertParserTraining() { var parseSamples = ParserTestUtil.CreateParseTrainStream(); var headRules = ParserTestUtil.CreateTestHeadRules(); var model = SharpNL.Parser.TreeInsert.Parser.Train("en", parseSamples, headRules, 100, 0); var parser = ParserFactory.Create(model); // Tests parsing to make sure the code does not has // a bug which fails always with a runtime exception var p = parser.Parse(Parse.ParseParse("She was just another freighter from the " + "States and she seemed as commonplace as her name .")); ParserModel deserialized; using (var data = new MemoryStream()) { model.Serialize(new UnclosableStream(data)); data.Seek(0, SeekOrigin.Begin); deserialized = new ParserModel(data); } Assert.NotNull(deserialized); // TODO: compare both models }