コード例 #1
0
        private void LoadVerbMasterTable(string folder)
        {
            string filepath = Path.Combine(folder, "VerbTable.csv");

            TextLoader loader = new TextLoaderDefaultEncoding(filepath);
            int        lines  = 0;

            while (loader.Peek() != null)
            {
                string line = loader.Next();


                //Create verb and add to collection and index
                if (lines > 0)
                {
                    Verb.Factory(line.Split(','));
                }

                lines++;
            }
        }
コード例 #2
0
        private void LoadVerbConjugation(string folder)
        {
            string filepath = Path.Combine(folder, "Conjugation.csv");

            TextLoader loader = new TextLoaderDefaultEncoding(filepath);
            int        lines  = 0;

            while (loader.Peek() != null)
            {
                string line = loader.Next();

                if (lines == 0)
                {
                    lines++;
                    continue;
                }



                string[] parts = line.Split(',');


                int CSVlineNum = System.Convert.ToInt32(parts[0]);
                var theVerb    = Verb.InfinitiveLookup(parts[1]);

                if (theVerb == null)
                {
                    Debug.WriteLine(String.Format("Line {0} Verb {1} missing from master table", CSVlineNum, parts[1]));
                }
                else
                {
                    Verb.Mode  m = Verb.ParseMode(parts[2]);
                    Verb.Tense t = Verb.ParseTense(parts[3]);
                    theVerb.AddConjugation(m, t, parts);
                }


                lines++;
            }
        }