Пример #1
0
        private static InputData _loadData(string dataDir)
        {
            var result = new InputData();

            PackNames.ForEach(packName =>
            {
                var sentences = _loadSentences(dataDir, packName + SampleExtension);
                if (sentences != null)
                    result.SampleSentences[packName] = sentences;

                sentences = _loadSentences(dataDir, packName + IppiExtension);
                if (sentences != null)
                    result.IppiSentences[packName] = sentences;

                sentences = _loadSentences(dataDir, packName + ComprenoExtension);
                if (sentences != null)
                    result.ComprenoSentences[packName] = sentences;
            });

            return result;
        }
Пример #2
0
        private static List<string> _validateData(InputData inputData)
        {
            var result = new List<string>();

            result.AddRange(
                inputData.IppiSentences.SelectMany(
                    pair =>
                        pair.Value.SelectMany(
                            (sentence, i) =>
                                SentenceValidator.Validate(sentence, i)
                                    .Select(s => String.Format("IPPI ({0}): {1}", pair.Key, s)))));

            result.AddRange(
                inputData.ComprenoSentences.SelectMany(
                    pair =>
                        pair.Value.SelectMany(
                            (sentence, i) =>
                                SentenceValidator.Validate(sentence, i)
                                    .Select(s => String.Format("Compreno ({0}): {1}", pair.Key, s)))));

            return result;
        }
Пример #3
0
        private static ComparisonData _groupSentencesIntoPacks(InputData inputData)
        {
            var result = new ComparisonData();

            PackNames.ForEach(packName =>
            {
                if (inputData.ComprenoSentences.ContainsKey(packName))
                {
                    result.ComprenoData[packName] = new SentencesPack
                    {
                        Target = inputData.ComprenoSentences[packName],
                        Sample = inputData.SampleSentences[packName]
                    };
                }

                if (inputData.IppiSentences.ContainsKey(packName))
                {
                    result.IppiData[packName] = new SentencesPack
                    {
                        Target = inputData.IppiSentences[packName],
                        Sample = inputData.SampleSentences[packName]
                    };
                }
            });

            return result;
        }