public OutputParses ( string tFile, string file ) : void | ||
tFile | string | |
file | string | |
리턴 | void |
/// <summary> /// Parses the specified sentence composed of words. /// </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="order">The order.</param> /// <param name="labels">The labels as an output.</param> /// <param name="deps">The deps as an output.</param> public static void Parse(string[] words, string[] posTags, string modelName, bool labeled, int order, out string[] labels, out int[] deps) { DependencyPipe pipe = order == 2 ? new DependencyPipe2O(true) : new DependencyPipe(true); pipe.setLabel(labeled); var dp = new DependencyParser(pipe); dp.LoadModel(modelName); pipe.CloseAlphabets(); dp.OutputParses(words, posTags, out labels, out deps); }
/// <summary> /// Parses the specified words with the specified trained parser. /// </summary> /// <param name="words">The words.</param> /// <param name="posTags">The pos tags.</param> /// <param name="parser">The trained parser.</param> /// <param name="labels">The labels.</param> /// <param name="deps">The deps.</param> public static void Parse(string[] words, string[] posTags, DependencyParser parser, out string[] labels, out int[] deps) { parser.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); }