private void WriteToTranslationDb(object sender, EventArgs e, IEnumerable <string> input, FileInfo spInput, FileInfo transAndAlign)
        {
            Queue <string> inputQueue
                = new Queue <string>(input);

            if (transAndAlign.Exists)
            {
                using (var reader = transAndAlign.OpenText())
                {
                    while (!reader.EndOfStream)
                    {
                        var line       = reader.ReadLine();
                        var sourceLine = inputQueue.Dequeue();
                        var transPair  = new TranslationPair(sourceLine, line, this.segmentation, this.TargetCode);
                        TranslationDbHelper.WriteTranslationToDb(sourceLine, transPair, this.SystemName, this.segmentation, this.TargetCode);
                    }
                }
            }
        }
Example #2
0
        private void WriteToTranslationDb(object sender, EventArgs e, IEnumerable <string> input, FileInfo spOutput)
        {
            Queue <string> inputQueue
                = new Queue <string>(input);

            if (spOutput.Exists)
            {
                using (var reader = spOutput.OpenText())
                {
                    while (!reader.EndOfStream)
                    {
                        var line       = reader.ReadLine();
                        var nonSpLine  = (line.Replace(" ", "")).Replace("▁", " ").Trim();
                        var sourceLine = inputQueue.Dequeue();
                        TranslationDbHelper.WriteTranslationToDb(sourceLine, nonSpLine, this.SystemName);
                    }
                }
            }
        }