Exemple #1
0
        private static IList <IList <string> > ReadRecords(StreamReader file)
        {
            var classifications = LoadClassifications();

            return(file.CSVLines()
                   .Select(x => new List <string>
            {
                // Skip animal name
                x[1] == "1" ? "yes" : "no",
                x[2] == "1" ? "yes" : "no",
                x[3] == "1" ? "yes" : "no",
                x[4] == "1" ? "yes" : "no",
                x[5] == "1" ? "yes" : "no",
                x[6] == "1" ? "yes" : "no",
                x[7] == "1" ? "yes" : "no",
                x[8] == "1" ? "yes" : "no",
                x[9] == "1" ? "yes" : "no",
                x[10] == "1" ? "yes" : "no",
                x[11] == "1" ? "yes" : "no",
                x[12] == "1" ? "yes" : "no",
                x[13],
                x[14] == "1" ? "yes" : "no",
                x[15] == "1" ? "yes" : "no",
                x[16] == "1" ? "yes" : "no",
                classifications[x[17]],
            } as IList <string>)
                   .ToList());
        }
Exemple #2
0
        private static IDictionary <string, string> LoadClassifications()
        {
            var file = new StreamReader(new FileStream("Resources/class.csv", FileMode.Open));

            file.ReadLine(); // discard headers

            return(file.CSVLines()
                   .ToDictionary(x => x[ClassFileClassNumberColumnIndex],
                                 x => x[ClassFileClassLabelColumnIndex]));
        }
Exemple #3
0
 private static IList <IList <string> > ReadRecords(StreamReader file)
 {
     return(file.CSVLines()
            .ToList());
 }