Beispiel #1
0
        public static ComparisonData CorrectErrors(ComparisonData dataPacks,
            Dictionary<string, PackClasterizedErrors> errorClassificationData, int correctionClass)
        {
            var correctedDataPacks = new ComparisonData
            {
                ComprenoData = dataPacks.ComprenoData.ToDictionary(pair => pair.Key, pair =>
                    ErrorCorrectionEmulator.CorrectErrors(pair.Value, errorClassificationData[pair.Key].ComprenoErrors, correctionClass)),
                IppiData = dataPacks.IppiData.ToDictionary(pair => pair.Key, pair =>
                    ErrorCorrectionEmulator.CorrectErrors(pair.Value, errorClassificationData[pair.Key].IppiErrors, correctionClass))
            };

            correctedDataPacks.ComprenoSummaries = CalculateEmulatedSummary(correctedDataPacks.ComprenoData,
                errorClassificationData.ToDictionary(pair => pair.Key, pair => pair.Value.ComprenoErrors),
                correctionClass);

            correctedDataPacks.IppiSummaries = CalculateEmulatedSummary(correctedDataPacks.IppiData,
                errorClassificationData.ToDictionary(pair => pair.Key, pair => pair.Value.IppiErrors),
                correctionClass);

            return correctedDataPacks;
        }
Beispiel #2
0
 private static ComparisonData _simulateErrorCorrection(ComparisonData dataPacks, Dictionary<string, PackClasterizedErrors> errorClassificationData, int correctionClass)
 {
     return Core.CorrectErrors(dataPacks, errorClassificationData, correctionClass);
 }
Beispiel #3
0
 private static List<string> _runComparison(ComparisonData dataPacks)
 {
     return dataPacks.ComprenoData.Values.Concat(dataPacks.IppiData.Values).SelectMany(_runComparison).ToList();
 }
Beispiel #4
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;
        }
Beispiel #5
0
 private static void _exportTotalSummaryData(ComparisonData dataPacks, string resultsDir, string filePrefix)
 {
     DataExporter.WriteSummary(dataPacks.IppiSummaries, Path.Combine(resultsDir, filePrefix + IppiResultsExtension));
     DataExporter.WriteSummary(dataPacks.ComprenoSummaries, Path.Combine(resultsDir, filePrefix + ComprenoResultsExtension));
 }
Beispiel #6
0
 private static void _exportSimpleSentencesSummary(ComparisonData dataPacks, string resultsDir, string filePrefix)
 {
     DataExporter.WriteSSSummary(dataPacks.IppiSummaries, dataPacks.ComprenoSummaries, Path.Combine(resultsDir, filePrefix + ".xlsx"));
 }
Beispiel #7
0
        private static void _exportSimpleSentences(ComparisonData dataPacks, string resultsDir)
        {
            PackNames.ForEach(packName =>
            {
                if (dataPacks.ComprenoData.ContainsKey(packName))
                    _exportSimpleSentences(dataPacks.ComprenoData[packName], resultsDir,
                        packName + ComprenoSSResultsExtension);

                if (dataPacks.IppiData.ContainsKey(packName))
                    _exportSimpleSentences(dataPacks.IppiData[packName], resultsDir,
                        packName + IppiSSResultsExtension);
            });
        }
Beispiel #8
0
        private static void _exportPackSentencesSummary(ComparisonData dataPacks, string resultsDir)
        {
            PackNames.ForEach(packName =>
            {
                if (dataPacks.ComprenoData.ContainsKey(packName))
                    _exportPackSentencesSummary(dataPacks.ComprenoData[packName], dataPacks.ComprenoSummaries[packName], resultsDir, packName + ComprenoPackStatsExtension);

                if (dataPacks.IppiData.ContainsKey(packName))
                    _exportPackSentencesSummary(dataPacks.IppiData[packName], dataPacks.IppiSummaries[packName], resultsDir, packName + IppiPackStatsExtension);
            });
        }
Beispiel #9
0
 private static void _exportErrors(ComparisonData dataPacks, string resultsDir)
 {
     PackNames.ForEach(s =>
     {
         DataExporter.ExportErrors(dataPacks.ComprenoErrors[s], s, Path.Combine(resultsDir, "Compreno." + s));
         DataExporter.ExportErrors(dataPacks.IppiErrors[s], s, Path.Combine(resultsDir, "Ippi." + s));
     });
 }
Beispiel #10
0
 private static void _computeTotalSummary(ComparisonData dataPacks)
 {
     dataPacks.IppiSummaries = Core.CalculateSummary(dataPacks.IppiData);
     dataPacks.ComprenoSummaries = Core.CalculateSummary(dataPacks.ComprenoData);
 }
Beispiel #11
0
 private static Dictionary<string, double> _computePackShares(ComparisonData dataPacks)
 {
     var totalSentences = (double)dataPacks.ComprenoSummaries.Values.Aggregate(0, (i, pack) => i + pack.SentencesCount);
     return dataPacks.ComprenoSummaries.ToDictionary(pair => pair.Key, pair => pair.Value.SentencesCount/totalSentences);
 }
Beispiel #12
0
 private static void _analyzeErros(ComparisonData dataPacks)
 {
     dataPacks.IppiErrors = Core.AnalyzeErrors(dataPacks.IppiData);
     dataPacks.ComprenoErrors = Core.AnalyzeErrors(dataPacks.ComprenoData);
 }