Ejemplo n.º 1
0
        private void CreateNewData(string cleanDataPath, string tagDataPath, string noEmptyPath, string wbrPath, string outputPath)
        {
            var noEmptyList = File.ReadLines(cleanDataPath).Select(x => x.Replace(" ", string.Empty));

            File.WriteAllLines(noEmptyPath, noEmptyList);
            var tagList = File.ReadLines(tagDataPath).Select(x => StringProcess.GetTagPrefixIndices(x));



            //RunWordBreak rwb = new RunWordBreak(Cfg);
            //rwb.WordBreak(noEmptyPath, wbrPath);

            var wbrList    = File.ReadLines(wbrPath);
            var outputList = wbrList.Zip(tagList, (x, y) => StringProcess.InsertTagToWords(x, " <bi> ", y)).Select(x => StringProcess.CleanupSpace(x));

            File.WriteAllLines(outputPath, outputList);
        }
Ejemplo n.º 2
0
        private void RefreshTextGridWbr(string cleanDatapath, string tagDataPath, string outputPath, string wbrPath, string tag)
        {
            string tmpName     = Guid.NewGuid().ToString();
            string noEmptyPath = Path.Combine(Cfg.TmpFolder, tmpName + ".noEmpty");

            var noEmptyList = File.ReadLines(cleanDatapath).Select(x => x.Replace(" ", string.Empty));

            File.WriteAllLines(noEmptyPath, noEmptyList);

            RunWordBreak rwb = new RunWordBreak(Cfg);

            rwb.WordBreak(noEmptyPath, wbrPath);

            var tagList    = File.ReadLines(tagDataPath).Select(x => StringProcess.GetTagPrefixIndices(x));
            var wbrList    = File.ReadLines(wbrPath);
            var outputList = wbrList.Zip(tagList, (x, y) => StringProcess.InsertTagToWords(x, " " + tag + " ", y)).Select(x => StringProcess.CleanupSpace(x));

            File.WriteAllLines(outputPath, outputList);
        }