コード例 #1
0
        /// <summary>
        /// Converts the master label file to label files.
        /// </summary>
        /// <param name="mlfFileName">The name of target master label file.</param>
        /// <param name="alignmentDir">The directory of the alignment files.</param>
        /// <param name="alignOption">The given alignment data.</param>
        public static void ConvertMlfToLabelFiles(string mlfFileName, string alignmentDir, LabelAlignOptions alignOption)
        {
            TrainingSentenceSet set = new TrainingSentenceSet();
            set.Load(mlfFileName);

            foreach (KeyValuePair<string, Sentence> pair in set.Sentences)
            {
                string labelFile = FileExtensions.AppendExtensionName(pair.Key, FileExtensions.LabelFile);
                using (StreamWriter sw = new StreamWriter(Path.Combine(alignmentDir, labelFile)))
                {
                    pair.Value.Save(sw, LabelTypeOptions.FullContext, alignOption, true);
                }
            }
        }
コード例 #2
0
 /// <summary>
 /// Builds the file list and then save them to file.
 /// </summary>
 /// <param name="masterLabelFile">The file name of the master label file.</param>
 /// <param name="corpusPath">Path of the corpus for which file list will be built.</param>
 /// <param name="fileListFile">Path of the target fileList.</param>
 /// <param name="extension">Extension of the corpus.</param>
 public static void GenerateFileListFile(string masterLabelFile,
     string corpusPath, string fileListFile, string extension)
 {
     TrainingSentenceSet trainingSet = new TrainingSentenceSet();
     trainingSet.Load(masterLabelFile);
     trainingSet.GenerateFileListFile(corpusPath, fileListFile, extension);
 }