public ParserMain(Grammar grammar, InkML inkml_file, int topn, int neighbors, string classify_url, double prob_threshold, string stats_file) { TOP_N = topn; MAX_NEIGHBORS = neighbors; // YUCK!! COPY AND PASTE BELOW. // Set symbol tables and input file. Instantiate the lexer. Create empty valid parse list. //initializeTables(symbolDefFile); lexer = new LexerMain(stats_file, classify_url, prob_threshold); validParses = new List <ValidParseTree>(); this.grammar = grammar; layoutClasses = grammar.GetLayoutClasses(); // Obtain LBT, stroke information. inputInkML = inkml_file; initLBT = new LBT(inputInkML, LBT.DefaultAdjacentCriterion); treeRoot = new ParseTreeNode(); treeRoot.nodeType = "S"; treeRoot.lbt = initLBT; // treeRoot.lexResult ??? //strokeList = lbt.strokes; // unused? currentSymbol = null; minRequiredStrokes = 1; unusedInputStrokes = initLBT.strokes.Count; parseStateStack = new Stack(); //Console.WriteLine(tree.ToDOT()); // Create root node. //rootAll = new ParseTreeNode("S", tree); // HACK: note that the ParseState constructor will initialize the parser data as well. //ParseState initState = new ParseState(rootAll, tree); //, 5); // MAGIC accesses = 0; hits = 0; // Invoke the parse #if DEBUG //Console.WriteLine("Starting parse..."); #endif //Parse(initState, true, MAX_NEIGHBORS); //validParses.Sort(); }
// RZ: New constructor -> replaces the lexer. public ParserMain(Grammar grammar, InkML inkml_file, int topn, int neighbors, string classify_url, double prob_threshold, string stats_file, string segmentFile, List <Stroke> strokeData) : this(grammar, inkml_file, topn, neighbors, classify_url, prob_threshold, stats_file) { lexer = new LexerMain(stats_file, classify_url, prob_threshold, segmentFile, strokeData); }