/// <summary> /// Parses the specified words, order is by default 2 /// </summary> /// <param name="words">The words.</param> /// <param name="posTags">The pos tags.</param> /// <param name="modelName">Name of the model.</param> /// <param name="labeled">if set to <c>true</c> [labeled].</param> /// <param name="labels">The labels.</param> /// <param name="deps">The deps.</param> public static void Parse(string[] words, string[] posTags, string modelName, bool labeled, out string[] labels, out int[] deps) { DependencyPipe pipe = new DependencyPipe2O(true); pipe.setLabel(labeled); var dp = new DependencyParser(pipe); dp.LoadModel(modelName); pipe.CloseAlphabets(); dp.OutputParses(words, posTags, out labels, out deps); }
/// <summary> /// Tests the specified test file. /// </summary> /// <param name="testFile">The test file.</param> /// <param name="modelName">Model Path</param> /// <param name="outFile">The parser output path</param> /// <param name="order">is either 1 or 2 /// Default is 1 /// Specifies the order/scope of features. 1 only has features over single edges /// and 2 has features over pairs of adjacent edges in the tree</param> public static void Test(string testFile, string modelName, string outFile, int order) { DependencyParser.SecondOrder = (order == 2 ? true : false); DependencyPipe pipe = order == 2 ? new DependencyPipe2O(true) : new DependencyPipe(true); pipe.SetLabeled(testFile); var dp = new DependencyParser(pipe); dp.LoadModel(modelName); pipe.CloseAlphabets(); dp.OutputParses(testFile, outFile); }